mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-11-03 02:33:24 +08:00
Fix situation when WebRTC candidate pair changes multiple times #1282
This commit is contained in:
@@ -51,6 +51,10 @@ func NewConn(pc *webrtc.PeerConnection) *Conn {
|
||||
}
|
||||
pc.SCTP().Transport().ICETransport().OnSelectedCandidatePairChange(
|
||||
func(pair *webrtc.ICECandidatePair) {
|
||||
// fix situation when candidate pair changes multiple times
|
||||
if i := strings.IndexByte(c.Protocol, '+'); i > 0 {
|
||||
c.Protocol = c.Protocol[:i]
|
||||
}
|
||||
c.Protocol += "+" + pair.Remote.Protocol.String()
|
||||
c.RemoteAddr = fmt.Sprintf(
|
||||
"%s:%d %s", sanitizeIP6(pair.Remote.Address), pair.Remote.Port, pair.Remote.Typ,
|
||||
|
||||
Reference in New Issue
Block a user