diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/webrtc/tests/mochitests/test_peerConnection_encodingsNegotiation.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_encodingsNegotiation.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_peerConnection_encodingsNegotiation.html | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_encodingsNegotiation.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_encodingsNegotiation.html new file mode 100644 index 0000000000..f46d7eb0d2 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_encodingsNegotiation.html @@ -0,0 +1,85 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> + <script type="application/javascript" src="simulcast.js"></script> + <script type="application/javascript" src="helpers_from_wpt/sdp.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> +createHTML({ + bug: "1401592", + title: "Simulcast negotiation tests", + visible: true +}); + +// simulcast negotiation is mostly tested in wpt, but we test a few +// implementation-specific things here. +const tests = [ + async function checkVideoEncodingLimit() { + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + + const stream = await navigator.mediaDevices.getUserMedia({video: true}); + const sender = pc1.addTrack(stream.getTracks()[0]); + pc2.addTrack(stream.getTracks()[0]); + + await doOfferToRecvSimulcast(pc2, pc1, ["1", "2", "3", "4"]); + + const {encodings} = sender.getParameters(); + const rids = encodings.map(({rid}) => rid); + isDeeply(rids, ["1", "2", "3"]); + + pc1.close(); + pc2.close(); + stream.getTracks().forEach(track => track.stop()); + }, + + // wpt currently does not assume support for 3 encodings, which limits the + // effectiveness of its powers-of-2 test (since it can test only for 1 and 2) + async function checkScaleResolutionDownByAutoFillPowersOf2() { + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + const stream = await navigator.mediaDevices.getUserMedia({video: true}); + const sender = pc1.addTrack(stream.getTracks()[0]); + pc2.addTrack(stream.getTracks()[0]); + + await doOfferToRecvSimulcast(pc2, pc1, ["1", "2", "3"]); + + const {encodings} = sender.getParameters(); + const scaleValues = encodings.map(({scaleResolutionDownBy}) => scaleResolutionDownBy); + isDeeply(scaleValues, [4, 2, 1]); + }, + + async function checkLibwebrtcRidLengthLimit() { + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + + const stream = await navigator.mediaDevices.getUserMedia({video: true}); + const sender = pc1.addTrack(stream.getTracks()[0]); + pc2.addTrack(stream.getTracks()[0]); + + await doOfferToRecvSimulcast(pc2, pc1, ["foo", "wibblywobblyjeremybearimy"]); + const {encodings} = sender.getParameters(); + const rids = encodings.map(({rid}) => rid); + isDeeply(rids, ["foo"]); + + pc1.close(); + pc2.close(); + stream.getTracks().forEach(track => track.stop()); + }, +]; + +runNetworkTest(async () => { + for (const test of tests) { + info(`Running test: ${test.name}`); + await test(); + info(`Done running test: ${test.name}`); + } +}); + +</script> +</pre> +</body> +</html> |