Skip to content
Snippets Groups Projects
Commit 781b3b45 authored by Byron Campen's avatar Byron Campen
Browse files

Bug 1401592: Test that changes in rid order from JSEP are ignored. r=jib

parent be01be76
No related branches found
No related tags found
No related merge requests found
......@@ -238,4 +238,82 @@ promise_test(async t => {
assert_array_equals(rids, [undefined]);
}, 'sRD(simulcast offer), addTrack, then rollback brings us back to having a single encoding');
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const {sender} = pc1.addTransceiver(stream.getTracks()[0], {sendEncodings: [{rid: "foo"}, {rid: "bar"}]});
await doOfferToSendSimulcast(pc1, pc2);
await doAnswerToRecvSimulcast(pc1, pc2, ["bar", "foo"]);
assert_true(pc1.remoteDescription.sdp.includes("a=simulcast:recv bar;foo"), "Answer should have reordered rids");
assert_equals(pc1.getTransceivers().length, 1);
const {encodings} = sender.getParameters();
const rids = encodings.map(({rid}) => rid);
assert_array_equals(rids, ["foo", "bar"]);
}, 'Reordering of rids in sRD(answer) is ignored');
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const {sender} = pc1.addTransceiver(stream.getTracks()[0], {sendEncodings: [{rid: "foo"}, {rid: "bar"}]});
await doOfferToSendSimulcastAndAnswer(pc1, pc2, ["foo", "bar"]);
assert_equals(pc1.getTransceivers().length, 1);
let {encodings} = sender.getParameters();
let rids = encodings.map(({rid}) => rid);
assert_array_equals(rids, ["foo", "bar"]);
await doOfferToSendSimulcast(pc1, pc2);
await doAnswerToRecvSimulcast(pc1, pc2, ["bar", "foo"]);
assert_true(pc1.remoteDescription.sdp.includes("a=simulcast:recv bar;foo"), "Answer should have reordered rids");
assert_equals(pc1.getTransceivers().length, 1);
encodings = sender.getParameters().encodings;
rids = encodings.map(({rid}) => rid);
assert_array_equals(rids, ["foo", "bar"]);
}, 'Reordering of rids in sRD(reanswer) is ignored');
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const {sender} = pc1.addTransceiver(stream.getTracks()[0], {sendEncodings: [{rid: "foo"}, {rid: "bar"}]});
await doOfferToSendSimulcastAndAnswer(pc1, pc2, ["foo", "bar"]);
assert_equals(pc1.getTransceivers().length, 1);
let {encodings} = sender.getParameters();
let rids = encodings.map(({rid}) => rid);
assert_array_equals(rids, ["foo", "bar"]);
// doAnswerToSendSimulcast causes pc2 to barf unless we set the direction to
// sendrecv
pc2.getTransceivers()[0].direction = "sendrecv";
pc2.getTransceivers()[1].direction = "sendrecv";
await doOfferToRecvSimulcast(pc2, pc1, ["bar", "foo"]);
await doAnswerToSendSimulcast(pc2, pc1);
assert_true(pc1.remoteDescription.sdp.includes("a=simulcast:recv bar;foo"), "Reoffer should have reordered rids");
assert_equals(pc1.getTransceivers().length, 1);
encodings = sender.getParameters().encodings;
rids = encodings.map(({rid}) => rid);
assert_array_equals(rids, ["foo", "bar"]);
}, 'Reordering of rids in sRD(reoffer) is ignored');
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment