diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html')
-rw-r--r-- | testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html deleted file mode 100644 index 33f71800bd..0000000000 --- a/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-jitterBufferTarget-stats.html +++ /dev/null @@ -1,96 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<meta name="timeout" content="long"> -<title>Tests RTCRtpReceiver-jitterBufferTarget verified with stats</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/webrtc/RTCPeerConnection-helper.js"></script> -<body> -<script> -'use strict' - -function async_promise_test(func, name, properties) { - async_test(t => { - Promise.resolve(func(t)) - .catch(t.step_func(e => { throw e; })) - .then(() => t.done()); - }, name, properties); -} - -async_promise_test(t => applyJitterBufferTarget(t, "video", 4000), - "measure raising and lowering video jitterBufferTarget"); -async_promise_test(t => applyJitterBufferTarget(t, "audio", 4000), - "measure raising and lowering audio jitterBufferTarget"); - -async function applyJitterBufferTarget(t, kind, target) { - const caller = new RTCPeerConnection(); - t.add_cleanup(() => caller.close()); - const callee = new RTCPeerConnection(); - t.add_cleanup(() => callee.close()); - - const stream = await getNoiseStream({[kind]:true}); - t.add_cleanup(() => stream.getTracks().forEach(track => track.stop())); - caller.addTransceiver(stream.getTracks()[0], {streams: [stream]}); - caller.addTransceiver(stream.getTracks()[0], {streams: [stream]}); - - exchangeIceCandidates(caller, callee); - await exchangeOffer(caller, callee); - const [unconstrainedReceiver, constrainedReceiver] = callee.getReceivers(); - const haveRtp = Promise.all([ - new Promise(r => constrainedReceiver.track.onunmute = r), - new Promise(r => unconstrainedReceiver.track.onunmute = r) - ]); - await exchangeAnswer(caller, callee); - const chromeTimeout = new Promise(r => t.step_timeout(r, 1000)); // crbug.com/1295295 - await Promise.race([haveRtp, chromeTimeout]); - - // Allow some data to be processed to let the jitter buffer to stabilize a bit before measuring - await new Promise(r => t.step_timeout(r, 5000)); - - t.step(() => assert_equals(constrainedReceiver.jitterBufferTarget, null, - `jitterBufferTarget supported for ${kind}`)); - - constrainedReceiver.jitterBufferTarget = target; - t.step(() => assert_equals(constrainedReceiver.jitterBufferTarget, target, - `jitterBufferTarget increase target for ${kind}`)); - - const [increased, base] = await Promise.all([ - measureDelayFromStats(t, constrainedReceiver, 20), - measureDelayFromStats(t, unconstrainedReceiver, 20) - ]); - - t.step(() => assert_greater_than(increased , base, - `${kind} increased delay ${increased} ` + - ` greater than base delay ${base}`)); - - constrainedReceiver.jitterBufferTarget = 0; - - // Allow the jitter buffer to stabilize a bit before measuring - await new Promise(r => t.step_timeout(r, 5000)); - t.step(() => assert_equals(constrainedReceiver.jitterBufferTarget, 0, - `jitterBufferTarget decrease target for ${kind}`)); - - const decreased = await measureDelayFromStats(t, constrainedReceiver, 20); - - t.step(() => assert_less_than(decreased, increased, - `${kind} decreasedDelay ${decreased} ` + - `less than increased delay ${increased}`)); -} - -async function measureDelayFromStats(t, receiver, cycles) { - - let statsReport = await receiver.getStats(); - const oldInboundStats = [...statsReport.values()].find(({type}) => type == "inbound-rtp"); - - await new Promise(r => t.step_timeout(r, 1000 * cycles)); - - statsReport = await receiver.getStats(); - const inboundStats = [...statsReport.values()].find(({type}) => type == "inbound-rtp"); - - const delay = ((inboundStats.jitterBufferDelay - oldInboundStats.jitterBufferDelay) / - (inboundStats.jitterBufferEmittedCount - oldInboundStats.jitterBufferEmittedCount) * 1000); - - return delay; -} -</script> -</body> |