From 80a22de8bcd218c443858e0344921c80d97fc44a Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Thu, 30 Mar 2023 11:07:22 +0000 Subject: [PATCH] Bug 1824381 [wpt PR 39181] - WebRTC WPT: Test that the answer negotiates a subset of RTP header extensions, a=testonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic update from web-platform-tests WebRTC WPT: Test that the answer negotiates a subset of RTP header extensions as defined in JSEP https://www.rfc-editor.org/rfc/rfc8829.html#section-5.3.1: For each supported RTP header extension that is present in the offer, [add] an "a=extmap" line BUG=None Change-Id: Ic9e2195a8a6aa011c8938f8a5ef0d74055d36cc8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369845 Reviewed-by: Henrik Boström Commit-Queue: Philipp Hancke Cr-Commit-Position: refs/heads/main@{#1121783} -- wpt-commits: 10c4049e41aec3e9945381e64aa8ab638eb00a6f wpt-pr: 39181 --- .../webrtc/protocol/rtp-headerextensions.html | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/testing/web-platform/tests/webrtc/protocol/rtp-headerextensions.html b/testing/web-platform/tests/webrtc/protocol/rtp-headerextensions.html index 677813742fec..c377a613f6ea 100644 --- a/testing/web-platform/tests/webrtc/protocol/rtp-headerextensions.html +++ b/testing/web-platform/tests/webrtc/protocol/rtp-headerextensions.html @@ -76,4 +76,26 @@ a=setup:actpass }, testcase.description + ' header extension is supported.'); }); +promise_test(async t => { + const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); + + pc.addTransceiver('video'); + const offer = await pc.createOffer(); + const section = SDPUtils.splitSections(offer.sdp)[1]; + const extensions = SDPUtils.matchPrefix(section, 'a=extmap:') + .map(line => SDPUtils.parseExtmap(line)); + const extension_not_mid = extensions.find(e => e.uri !== 'urn:ietf:params:rtp-hdrext:sdes:mid'); + await pc.setRemoteDescription({type :'offer', sdp: offer.sdp.replace(extension_not_mid.uri, 'bogus')}); + + await pc.setLocalDescription(); + const answer_section = SDPUtils.splitSections(pc.localDescription.sdp)[1]; + const answer_extensions = SDPUtils.matchPrefix(answer_section, 'a=extmap:') + .map(line => SDPUtils.parseExtmap(line)); + assert_equals(answer_extensions.length, extensions.length - 1); + assert_false(!!extensions.find(e => e.uri === 'bogus')); + for (const answer_extension of answer_extensions) { + assert_true(!!extensions.find(e => e.uri === answer_extension.uri)); + } +}, 'Negotiates the subset of supported extensions offered');