Skip to content

Commit 6a38a3e

Browse files
fippoWebRTC LUCI CQ
authored andcommitted
sdp: reject duplicate ssrcs in ssrc-groups
while not really covered by https://www.rfc-editor.org/rfc/rfc5576.html#section-4.2 and using the same SSRC for RTX and primary payload may work since payload type demuxing *could* be used is not a good idea. This also applies to flexfec's FEC-FR. For the nonstandard SIM ssrc-group duplicates make no sense. This rejects duplicates for unknown ssrc-groups as well. BUG=chromium:1454860 Change-Id: I3e86101dbd5d6c4099f2fdb7b4a52d5cd0809c5f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308820 Reviewed-by: Taylor Brandstetter <[email protected]> Reviewed-by: Harald Alvestrand <[email protected]> Commit-Queue: Philipp Hancke <[email protected]> Cr-Commit-Position: refs/heads/main@{#40292}
1 parent b37f864 commit 6a38a3e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

pc/webrtc_sdp.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,6 +3545,11 @@ bool ParseSsrcGroupAttribute(absl::string_view line,
35453545
if (!GetValueFromString(line, fields[i], &ssrc, error)) {
35463546
return false;
35473547
}
3548+
// Reject duplicates. While not forbidden by RFC 5576,
3549+
// they don't make sense.
3550+
if (absl::c_linear_search(ssrcs, ssrc)) {
3551+
return ParseFailed(line, "Duplicate SSRC in ssrc-group", error);
3552+
}
35483553
ssrcs.push_back(ssrc);
35493554
}
35503555
ssrc_groups->push_back(SsrcGroup(semantics, ssrcs));

pc/webrtc_sdp_unittest.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,3 +5057,29 @@ TEST_F(WebRtcSdpTest, RejectSessionLevelMediaLevelExtmapMixedUsage) {
50575057
JsepSessionDescription jdesc(kDummyType);
50585058
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
50595059
}
5060+
5061+
TEST_F(WebRtcSdpTest, RejectDuplicateSsrcInSsrcGroup) {
5062+
std::string sdp =
5063+
"v=0\r\n"
5064+
"o=- 0 3 IN IP4 127.0.0.1\r\n"
5065+
"s=-\r\n"
5066+
"t=0 0\r\n"
5067+
"a=group:BUNDLE 0\r\n"
5068+
"a=fingerprint:sha-1 "
5069+
"4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB\r\n"
5070+
"a=setup:actpass\r\n"
5071+
"a=ice-ufrag:ETEn\r\n"
5072+
"a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n"
5073+
"m=video 9 UDP/TLS/RTP/SAVPF 96 97\r\n"
5074+
"c=IN IP4 0.0.0.0\r\n"
5075+
"a=rtcp-mux\r\n"
5076+
"a=sendonly\r\n"
5077+
"a=mid:0\r\n"
5078+
"a=rtpmap:96 VP8/90000\r\n"
5079+
"a=rtpmap:97 rtx/90000\r\n"
5080+
"a=fmtp:97 apt=96\r\n"
5081+
"a=ssrc-group:FID 1234 1234\r\n"
5082+
"a=ssrc:1234 cname:test\r\n";
5083+
JsepSessionDescription jdesc(kDummyType);
5084+
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
5085+
}

0 commit comments

Comments
 (0)