Skip to content

Commit

Permalink
Add WebRTC test for offer with duplicate a=msid line
Browse files Browse the repository at this point in the history
This is illegal according to RFC 8830 section 2.

Bug: webrtc:15845
Change-Id: I84c70d369178c9ee65aed94407c1524a19988318
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5296402
Reviewed-by: Florent Castelli <[email protected]>
Commit-Queue: Harald Alvestrand <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1261159}
  • Loading branch information
alvestrand authored and chromium-wpt-export-bot committed Feb 15, 2024
1 parent 231486e commit de8ec2f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions webrtc/RTCPeerConnection-setRemoteDescription-offer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script src="/webrtc/third_party/sdp/sdp.js"></script>
<script>
'use strict';

Expand Down Expand Up @@ -365,4 +366,19 @@
assert_equals(pc2.getTransceivers().length, 1);
}, 'Transceivers added by sRD(offer) should not show up until sRD resolves');

promise_test(async t => {
const pc1 = new RTCPeerConnection();
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
t.add_cleanup(() => pc2.close());
pc1.addTransceiver('video');
const description = await pc1.createOffer();
const sections = SDPUtils.splitSections(description.sdp);
// Compose SDP with a duplicated media section (equal MSID lines)
// This is not permitted according to RFC 8830 section 2.
const sdp = sections[0] + sections[1] + sections[1].replace('a=mid:', 'a=mid:unique');
const p = pc2.setRemoteDescription({type: 'offer', sdp: sdp});
await promise_rejects_dom(t, 'OperationError', p);
}, 'setRemoteDescription(section with duplicate msid) rejects');

</script>

0 comments on commit de8ec2f

Please sign in to comment.