From 8d6d3ba0595f60bbe1bc7053352d7fe389a96b24 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Wed, 22 Jan 2025 07:41:01 -0800 Subject: [PATCH] webrtc: add wpt for setCodecPreferences + rtx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG=chromium:387077342 Change-Id: I3289327d21e22a6c42edb56d3a9699a0a7cf8d06 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6186273 Reviewed-by: Harald Alvestrand Reviewed-by: Henrik Boström Commit-Queue: Philipp Hancke Cr-Commit-Position: refs/heads/main@{#1409660} --- ...RTCRtpTransceiver-setCodecPreferences.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/webrtc/RTCRtpTransceiver-setCodecPreferences.html b/webrtc/RTCRtpTransceiver-setCodecPreferences.html index b3129b49869fec..407e855edbd2b0 100644 --- a/webrtc/RTCRtpTransceiver-setCodecPreferences.html +++ b/webrtc/RTCRtpTransceiver-setCodecPreferences.html @@ -272,6 +272,25 @@ assert_equals(rtpParameters.codecs[0].name, firstCodec); }, `setCodecPreferences() modifies the order of video codecs in createOffer`); + ['rtx', 'red', 'ulpfec'].forEach(resiliencyMechanism => { + promise_test(async (t) => { + const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); + const transceiver = pc.addTransceiver('video'); + const {codecs} = RTCRtpReceiver.getCapabilities('video'); + const filteredCodecs = codecs. + filter(codec => codec.mimeType !== 'video/' + resiliencyMechanism); + assert_not_equals(codecs.length, filteredCodecs.length); + transceiver.setCodecPreferences(filteredCodecs); + + const offer = await pc.createOffer(); + const mediaSection = SDPUtils.getMediaSections(offer.sdp)[0]; + const rtpParameters = SDPUtils.parseRtpParameters(mediaSection); + assert_equals(rtpParameters.codecs.find(codec => codec.name === resiliencyMechanism), + undefined); + }, `setCodecPreferences() can remove ${resiliencyMechanism}`); + }); + // Tests the note removed as result of discussion in // https://github.com/w3c/webrtc-pc/issues/2933 promise_test(async (t) => {