Skip to content

Commit

Permalink
sdp: reject duplicate ssrcs in ssrc-groups
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
fippo authored and WebRTC LUCI CQ committed Jun 15, 2023
1 parent b37f864 commit 6a38a3e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pc/webrtc_sdp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3545,6 +3545,11 @@ bool ParseSsrcGroupAttribute(absl::string_view line,
if (!GetValueFromString(line, fields[i], &ssrc, error)) {
return false;
}
// Reject duplicates. While not forbidden by RFC 5576,
// they don't make sense.
if (absl::c_linear_search(ssrcs, ssrc)) {
return ParseFailed(line, "Duplicate SSRC in ssrc-group", error);
}
ssrcs.push_back(ssrc);
}
ssrc_groups->push_back(SsrcGroup(semantics, ssrcs));
Expand Down
26 changes: 26 additions & 0 deletions pc/webrtc_sdp_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5057,3 +5057,29 @@ TEST_F(WebRtcSdpTest, RejectSessionLevelMediaLevelExtmapMixedUsage) {
JsepSessionDescription jdesc(kDummyType);
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
}

TEST_F(WebRtcSdpTest, RejectDuplicateSsrcInSsrcGroup) {
std::string sdp =
"v=0\r\n"
"o=- 0 3 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
"t=0 0\r\n"
"a=group:BUNDLE 0\r\n"
"a=fingerprint:sha-1 "
"4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB\r\n"
"a=setup:actpass\r\n"
"a=ice-ufrag:ETEn\r\n"
"a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n"
"m=video 9 UDP/TLS/RTP/SAVPF 96 97\r\n"
"c=IN IP4 0.0.0.0\r\n"
"a=rtcp-mux\r\n"
"a=sendonly\r\n"
"a=mid:0\r\n"
"a=rtpmap:96 VP8/90000\r\n"
"a=rtpmap:97 rtx/90000\r\n"
"a=fmtp:97 apt=96\r\n"
"a=ssrc-group:FID 1234 1234\r\n"
"a=ssrc:1234 cname:test\r\n";
JsepSessionDescription jdesc(kDummyType);
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
}

0 comments on commit 6a38a3e

Please sign in to comment.