From d961dd730bed445e6fc370549817288662a95616 Mon Sep 17 00:00:00 2001 From: Stephan Rotolante Date: Fri, 19 Apr 2024 02:05:15 -0400 Subject: [PATCH] Skip some checks when BUNDLE group value is found Resolves #2621 --- peerconnection_go_test.go | 2 ++ sdp.go | 24 +++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/peerconnection_go_test.go b/peerconnection_go_test.go index e36c62f75b..e19753bbf2 100644 --- a/peerconnection_go_test.go +++ b/peerconnection_go_test.go @@ -1399,6 +1399,7 @@ func TestTransceiverCreatedByRemoteSdpHasSameCodecOrderAsRemote(t *testing.T) { o=- 4596489990601351948 2 IN IP4 127.0.0.1 s=- t=0 0 +a=group:BUNDLE video-1 video-2 m=video 60323 UDP/TLS/RTP/SAVPF 98 94 106 a=ice-ufrag:1/MvHwjAyVf27aLu a=ice-pwd:3dBU7cFOBl120v33cynDvN1E @@ -1459,6 +1460,7 @@ a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01 o=- 4596489990601351948 2 IN IP4 127.0.0.1 s=- t=0 0 +a=group:BUNDLE video-1 video-2 m=video 60323 UDP/TLS/RTP/SAVPF 98 106 a=ice-ufrag:1/MvHwjAyVf27aLu a=ice-pwd:3dBU7cFOBl120v33cynDvN1E diff --git a/sdp.go b/sdp.go index 980f985077..6ea1893471 100644 --- a/sdp.go +++ b/sdp.go @@ -709,8 +709,13 @@ func extractFingerprint(desc *sdp.SessionDescription) (string, string, error) { return "", "", ErrSessionDescriptionNoFingerprint } - for _, m := range fingerprints { - if m != fingerprints[0] { + // https://github.com/pion/webrtc/issues/2621 + groupAttribue, _ := desc.Attribute(sdp.AttrKeyGroup) + + isBundled := strings.Contains(groupAttribue, "BUNDLE") + + if !isBundled { + if len(fingerprints) != 1 { return "", "", ErrSessionDescriptionConflictingFingerprints } } @@ -769,14 +774,15 @@ func extractICEDetails(desc *sdp.SessionDescription, log logging.LeveledLogger) return "", "", nil, ErrSessionDescriptionMissingIcePwd } - for _, m := range remoteUfrags { - if m != remoteUfrags[0] { - return "", "", nil, ErrSessionDescriptionConflictingIceUfrag - } - } + // https://github.com/pion/webrtc/issues/2621 + groupAttribue, _ := desc.Attribute(sdp.AttrKeyGroup) + + isBundled := strings.Contains(groupAttribue, "BUNDLE") - for _, m := range remotePwds { - if m != remotePwds[0] { + if !isBundled { + if len(remoteUfrags) != 1 { + return "", "", nil, ErrSessionDescriptionConflictingIceUfrag + } else if len(remotePwds) != 1 { return "", "", nil, ErrSessionDescriptionConflictingIcePwd } }