From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/webrtc-svc/META.yml | 1 + .../RTCRtpParameters-scalability-av1.html | 43 ++++++++ .../RTCRtpParameters-scalability-h264.html | 18 +++ .../RTCRtpParameters-scalability-vp8.html | 18 +++ .../RTCRtpParameters-scalability-vp9.html | 43 ++++++++ .../webrtc-svc/RTCRtpParameters-scalability.html | 122 +++++++++++++++++++++ .../web-platform/tests/webrtc-svc/svc-helper.js | 50 +++++++++ 7 files changed, 295 insertions(+) create mode 100644 testing/web-platform/tests/webrtc-svc/META.yml create mode 100644 testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-av1.html create mode 100644 testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-h264.html create mode 100644 testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp8.html create mode 100644 testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp9.html create mode 100644 testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability.html create mode 100644 testing/web-platform/tests/webrtc-svc/svc-helper.js (limited to 'testing/web-platform/tests/webrtc-svc') diff --git a/testing/web-platform/tests/webrtc-svc/META.yml b/testing/web-platform/tests/webrtc-svc/META.yml new file mode 100644 index 0000000000..17d93c51a9 --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/META.yml @@ -0,0 +1 @@ +spec: https://w3c.github.io/webrtc-svc/ diff --git a/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-av1.html b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-av1.html new file mode 100644 index 0000000000..24cfcb8f4a --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-av1.html @@ -0,0 +1,43 @@ + + + +AV1 scalabilityMode + + + + + + diff --git a/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-h264.html b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-h264.html new file mode 100644 index 0000000000..2a595a8169 --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-h264.html @@ -0,0 +1,18 @@ + + + +H264 scalabilityMode + + + + + + diff --git a/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp8.html b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp8.html new file mode 100644 index 0000000000..1708ab1017 --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp8.html @@ -0,0 +1,18 @@ + + + +VP8 scalabilityMode + + + + + + diff --git a/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp9.html b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp9.html new file mode 100644 index 0000000000..f1f4923868 --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability-vp9.html @@ -0,0 +1,43 @@ + + + +VP9 scalabilityMode + + + + + + diff --git a/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability.html b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability.html new file mode 100644 index 0000000000..d8b1c6e135 --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/RTCRtpParameters-scalability.html @@ -0,0 +1,122 @@ + + + +RTCRtpParameters encodings + + + + + + diff --git a/testing/web-platform/tests/webrtc-svc/svc-helper.js b/testing/web-platform/tests/webrtc-svc/svc-helper.js new file mode 100644 index 0000000000..e73ccfa750 --- /dev/null +++ b/testing/web-platform/tests/webrtc-svc/svc-helper.js @@ -0,0 +1,50 @@ +function supportsCodec(mimeType) { + return RTCRtpSender.getCapabilities('video').codecs.filter(c => c.mimeType == mimeType).length() > 0; +} + +async function supportsScalabilityMode(mimeType, scalabilityMode) { + let result = await navigator.mediaCapabilities.encodingInfo({ + type: 'webrtc', + video: { + contentType: mimeType, + width: 60, + height: 60, + bitrate: 10000, + framerate: 30, + scalabilityMode: scalabilityMode + } + }); + return result.supported; +} + +function createScalabilityTest(mimeType, scalabilityModes) { + for (const scalabilityMode of scalabilityModes) { + promise_test(async t => { + assert_implements_optional( + supportsScalabilityMode(mimeType, scalabilityMode), + `${mimeType} supported` + ); + const v = document.createElement('video'); + v.autoplay = true; + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + const stream1 = await getNoiseStream({ video: { signal: 100, width: 60, height: 60 } }); + const [track1] = stream1.getTracks(); + t.add_cleanup(() => track1.stop()); + const transceiver = pc1.addTransceiver(track1, { + sendEncodings: [{ scalabilityMode: scalabilityMode }], + }); + transceiver.setCodecPreferences(RTCRtpSender.getCapabilities('video').codecs.filter(c => c.mimeType == mimeType)); + const haveTrackEvent = new Promise(r => pc2.ontrack = r); + exchangeIceCandidates(pc1, pc2); + await exchangeOfferAnswer(pc1, pc2); + v.srcObject = new MediaStream([(await haveTrackEvent).track]); + await new Promise(r => v.onloadedmetadata = r); + await detectSignal(t, v, 100); + const sendParams = pc1.getSenders()[0].getParameters(); + assert_equals(sendParams.encodings[0].scalabilityMode, scalabilityMode); + }, `${mimeType} - ${scalabilityMode} should produce valid video content`); + } +} -- cgit v1.2.3