Bug 1642763 [wpt PR 23924] - webrtc wpt: add test for setParameters active=false w/simulcast, a=testonly
authorPhilipp Hancke <philipp.hancke@googlemail.com>
Wed, 10 Jun 2020 11:23:27 +0000
changeset 535297 ca06a4c8ebebfb4343405cc6d674b1094f6713e0
parent 535296 73cb6ceaac11225bc2e62718f7c8b636ac275be3
child 535298 9ef47e158e40fdbf45b4271102acddf8bfa1cf92
push id37501
push usernbeleuzu@mozilla.com
push dateSat, 13 Jun 2020 03:21:52 +0000
treeherdermozilla-central@80b6f21783a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1642763, 23924, 2225774, 774521
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1642763 [wpt PR 23924] - webrtc wpt: add test for setParameters active=false w/simulcast, a=testonly Automatic update from web-platform-tests webrtc wpt: add test for setParameters active=false w/simulcast adds a test that verifies setting active to false on all three layers stops sending frames. Ref https://github.com/w3c/webrtc-pc/issues/2470 BUG=None Change-Id: Ic6bf346085af98cce13c90e141f83224e57069d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225774 Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/master@{#774521} -- wpt-commits: 6eb518483cb32130260cd8bdb356214c56a55080 wpt-pr: 23924
testing/web-platform/tests/webrtc/simulcast/setParameters-active.https.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webrtc/simulcast/setParameters-active.https.html
@@ -0,0 +1,51 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>RTCPeerConnection Simulcast Tests - setParameters/active</title>
+<meta name="timeout" content="long">
+<script src="../third_party/sdp/sdp.js"></script>
+<script src="simulcast.js"></script>
+<script src="../RTCPeerConnection-helper.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async function queryReceiverStats(pc) {
+  const inboundStats = [];
+  await Promise.all(pc.getReceivers().map(async receiver => {
+    const receiverStats = await receiver.getStats();
+    receiverStats.forEach(stat => {
+      if (stat.type === 'inbound-rtp') {
+        inboundStats.push(stat);
+      }
+    });
+  }));
+  return inboundStats.map(s => s.framesDecoded);
+}
+
+promise_test(async t => {
+  const rids = [0, 1, 2];
+  const pc1 = new RTCPeerConnection();
+  t.add_cleanup(() => pc1.close());
+  const pc2 = new RTCPeerConnection();
+  t.add_cleanup(() => pc2.close());
+
+  await negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2);
+
+  // Deactivate all senders.
+  const parameters = pc1.getSenders()[0].getParameters();
+  parameters.encodings.forEach(e => {
+    e.active = false;
+  });
+  await pc1.getSenders()[0].setParameters(parameters);
+
+  // Assert (almost) no new frames are received.
+  // Without any action we would expect to have received around 30fps.
+  await new Promise(resolve => t.step_timeout(resolve, 100)); // Wait a bit.
+  const initialStats = await queryReceiverStats(pc2);
+  await new Promise(resolve => t.step_timeout(resolve, 1000)); // Wait more.
+  const subsequentStats = await queryReceiverStats(pc2);
+
+  subsequentStats.forEach((framesDecoded, idx) => {
+    assert_equals(framesDecoded, initialStats[idx]);
+  });
+}, 'Simulcast setParameters active=false stops sending frames');
+</script>