summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html')
-rw-r--r--testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html101
1 files changed, 101 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html
new file mode 100644
index 0000000000..3e348f0d14
--- /dev/null
+++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html
@@ -0,0 +1,101 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>RTCRtpParameters encodings</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/webrtc/dictionary-helper.js"></script>
+<script src="/webrtc/RTCRtpParameters-helper.js"></script>
+<script>
+'use strict';
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ assert_throws_js(RangeError, () => pc.addTransceiver('video', {
+ sendEncodings: [{
+ maxFramerate: -10
+ }]
+ }));
+}, `addTransceiver() with sendEncoding.maxFramerate field set to less than 0 should reject with RangeError`);
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ let {sender} = pc.addTransceiver('audio', {
+ sendEncodings: [{
+ maxFramerate: -10
+ }]
+ });
+ let encodings = sender.getParameters().encodings;
+ assert_equals(encodings.length, 1);
+ assert_not_own_property(encodings[0], "maxFramerate");
+
+ sender = pc.addTransceiver('audio', {
+ sendEncodings: [{
+ maxFramerate: 10
+ }]
+ }).sender;
+ encodings = sender.getParameters().encodings;
+ assert_equals(encodings.length, 1);
+ assert_not_own_property(encodings[0], "maxFramerate");
+}, `addTransceiver('audio') with sendEncoding.maxFramerate should succeed, but remove the maxFramerate, even if it is invalid`);
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {sender} = pc.addTransceiver('audio');
+ let params = sender.getParameters();
+ assert_equals(params.encodings.length, 1);
+ params.encodings[0].maxFramerate = 20;
+ await sender.setParameters(params);
+ const {encodings} = sender.getParameters();
+ assert_equals(encodings.length, 1);
+ assert_not_own_property(encodings[0], "maxFramerate");
+}, `setParameters with maxFramerate on an audio sender should succeed, but remove the maxFramerate`);
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {sender} = pc.addTransceiver('audio');
+ let params = sender.getParameters();
+ assert_equals(params.encodings.length, 1);
+ params.encodings[0].maxFramerate = -1;
+ await sender.setParameters(params);
+ const {encodings} = sender.getParameters();
+ assert_equals(encodings.length, 1);
+ assert_not_own_property(encodings[0], "maxFramerate");
+}, `setParameters with an invalid maxFramerate on an audio sender should succeed, but remove the maxFramerate`);
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const { sender } = pc.addTransceiver('video');
+ await doOfferAnswerExchange(t, pc);
+
+ const param = sender.getParameters();
+ const encoding = param.encodings[0];
+ assert_not_own_property(encoding, "maxFramerate");
+
+ encoding.maxFramerate = -10;
+ return promise_rejects_js(t, RangeError,
+ sender.setParameters(param));
+}, `setParameters() with encoding.maxFramerate field set to less than 0 should reject with RangeError`);
+
+// It would be great if we could test to see whether maxFramerate is actually
+// honored.
+test_modified_encoding('video', 'maxFramerate', 24, 16,
+ 'setParameters() with maxFramerate 24->16 should succeed');
+
+test_modified_encoding('video', 'maxFramerate', undefined, 16,
+ 'setParameters() with maxFramerate undefined->16 should succeed');
+
+test_modified_encoding('video', 'maxFramerate', 24, undefined,
+ 'setParameters() with maxFramerate 24->undefined should succeed');
+
+test_modified_encoding('video', 'maxFramerate', 0, 16,
+ 'setParameters() with maxFramerate 0->16 should succeed');
+
+test_modified_encoding('video', 'maxFramerate', 24, 0,
+ 'setParameters() with maxFramerate 24->0 should succeed');
+
+</script>