Commit 1e2e0f67 authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

Revert "webrtc: add wpt test that setCodecPreferences changes the sdp"

This reverts commit a1d50a60.

Reason for revert: Breaks here:
https://ci.chromium.org/p/chromium/builders/ci/linux-bfcache-rel/7613

Original change's description:
> webrtc: add wpt test that setCodecPreferences changes the sdp
> 
> Adds a test which verifies that setCodecPreferences changes the
> order of codecs in the SDP generated by createOffer.
> 
> Drive-by: close all peerconnections after the tests,
>   https://bugs.chromium.org/p/chromium/issues/detail?id=836871
> 
> BUG=None
> 
> Change-Id: I75d252bc43919ba2f27c6bd97493f94b3b5a2587
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362024
> Reviewed-by: Harald Alvestrand <hta@chromium.org>
> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
> Cr-Commit-Position: refs/heads/master@{#799168}

TBR=hta@chromium.org,philipp.hancke@googlemail.com,orphis@chromium.org

Change-Id: I5c76ee9de7a660b14cfe56a4835ca4bcde59c432
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363471Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799221}
parent 72858417
......@@ -3,7 +3,6 @@
<title>RTCRtpTransceiver.prototype.setCodecPreferences</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./third_party/sdp/sdp.js"></script>
<script>
'use strict';
......@@ -30,41 +29,40 @@
an InvalidModificationError.
*/
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
transceiver.setCodecPreferences(capabilities.codecs);
}, `setCodecPreferences() on audio transceiver with codecs returned from RTCRtpSender.getCapabilities('audio') should succeed`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('video');
const capabilities = RTCRtpReceiver.getCapabilities('video');
transceiver.setCodecPreferences(capabilities.codecs);
}, `setCodecPreferences() on video transceiver with codecs returned from RTCRtpReceiver.getCapabilities('video') should succeed`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities1 = RTCRtpSender.getCapabilities('audio');
const capabilities2 = RTCRtpReceiver.getCapabilities('audio');
transceiver.setCodecPreferences([...capabilities1.codecs, ... capabilities2.codecs]);
}, `setCodecPreferences() with both sender receiver codecs combined should succeed`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
transceiver.setCodecPreferences([]);
}, `setCodecPreferences([]) should succeed`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
const { codecs } = capabilities;
......@@ -76,11 +74,11 @@
}
transceiver.setCodecPreferences(codecs);
}, `setCodecPreferences() with reordered codecs should succeed`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('video');
const capabilities = RTCRtpSender.getCapabilities('video');
const { codecs } = capabilities;
......@@ -96,17 +94,16 @@
assert_true(tried, 'VP8 video codec was found and tried');
}, `setCodecPreferences() with only one video codec should succeed`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('video');
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(capabilities.codecs));
}, `setCodecPreferences() on audio transceiver with codecs returned from getCapabilities('video') should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const codecs = [{
mimeType: 'data',
......@@ -116,11 +113,11 @@
}];
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with user defined codec with invalid mimeType should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const codecs = [{
mimeType: 'audio/piepiper',
......@@ -130,11 +127,11 @@
}];
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with user defined codec should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
const codecs = [
......@@ -147,44 +144,44 @@
}];
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with user defined codec together with codecs returned from getCapabilities() should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
const codecs = [capabilities.codecs[0]];
codecs[0].clockRate = codecs[0].clockRate / 2;
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with modified codec clock rate should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
const codecs = [capabilities.codecs[0]];
codecs[0].channels = codecs[0].channels + 11;
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with modified codec channel count should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
const codecs = [capabilities.codecs[0]];
codecs[0].sdpFmtpLine = "modifiedparameter=1";
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with modified codec parameters should throw InvalidModificationError`);
test((t) => {
test(() => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('audio');
......@@ -197,72 +194,7 @@
codec.channels = channels+1;
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(codecs));
}, `setCodecPreferences() with modified codecs returned from getCapabilities() should throw InvalidModificationError`);
promise_test(async (t) => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('audio');
const {codecs} = RTCRtpSender.getCapabilities('audio');
// Reorder codecs, put PCMU/PCMA first.
let firstCodec;
let i;
for (i = 0; i < codecs.length; i++) {
const codec = codecs[i];
if (codec.mimeType === 'audio/PCMU' || codec.mimeType === 'audio/PCMA') {
codecs.splice(i, 1);
codecs.unshift(codec);
firstCodec = codec.mimeType.substr(6);
break;
}
}
assert_not_equals(firstCodec, undefined, 'PCMU or PCMA codec not found');
transceiver.setCodecPreferences(codecs);
const offer = await pc.createOffer();
const mediaSection = SDPUtils.getMediaSections(offer.sdp)[0];
const rtpParameters = SDPUtils.parseRtpParameters(mediaSection);
assert_equals(rtpParameters.codecs[0].name, firstCodec);
}, `setCodecPreferences() modifies the order of audio codecs in createOffer`);
promise_test(async (t) => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const transceiver = pc.addTransceiver('video');
const {codecs} = RTCRtpSender.getCapabilities('video');
// Reorder codecs, swap H264 and VP8.
let vp8 = -1;
let h264 = -1;
let firstCodec;
let i;
for (i = 0; i < codecs.length; i++) {
const codec = codecs[i];
if (codec.mimeType === 'video/VP8') {
vp8 = i;
if (h264 !== -1) {
codecs[vp8] = codecs[h264];
codecs[h264] = codec;
firstCodec = 'VP8';
break;
}
}
if (codec.mimeType === 'video/H264') {
h264 = i;
if (vp8 !== -1) {
codecs[h264] = codecs[vp8];
codecs[vp8] = codec;
firstCodec = 'H264';
break;
}
}
}
assert_not_equals(firstCodec, undefined, 'VP8 and H264 codecs not found');
transceiver.setCodecPreferences(codecs);
const offer = await pc.createOffer();
const mediaSection = SDPUtils.getMediaSections(offer.sdp)[0];
const rtpParameters = SDPUtils.parseRtpParameters(mediaSection);
assert_equals(rtpParameters.codecs[0].name, firstCodec);
}, `setCodecPreferences() modifies the order of video codecs in createOffer`);
}, `setCodecPreferences() with modified codecs returned from getCapabilities() should throw InvalidModificationError`);
</script>
......@@ -13,7 +13,5 @@ FAIL setCodecPreferences() with modified codec clock rate should throw InvalidMo
FAIL setCodecPreferences() with modified codec channel count should throw InvalidModificationError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
FAIL setCodecPreferences() with modified codec parameters should throw InvalidModificationError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
FAIL setCodecPreferences() with modified codecs returned from getCapabilities() should throw InvalidModificationError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
FAIL setCodecPreferences() modifies the order of audio codecs in createOffer promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL setCodecPreferences() modifies the order of video codecs in createOffer promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment