summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc/protocol/simulcast-answer.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/webrtc/protocol/simulcast-answer.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webrtc/protocol/simulcast-answer.html')
-rw-r--r--testing/web-platform/tests/webrtc/protocol/simulcast-answer.html101
1 files changed, 101 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc/protocol/simulcast-answer.html b/testing/web-platform/tests/webrtc/protocol/simulcast-answer.html
new file mode 100644
index 0000000000..5e19bc08ff
--- /dev/null
+++ b/testing/web-platform/tests/webrtc/protocol/simulcast-answer.html
@@ -0,0 +1,101 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>RTCPeerConnection Simulcast Answer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+'use strict';
+
+const offer_sdp = `v=0
+o=- 3840232462471583827 2 IN IP4 127.0.0.1
+s=-
+t=0 0
+a=group:BUNDLE 0
+a=msid-semantic: WMS
+m=video 9 UDP/TLS/RTP/SAVPF 96
+c=IN IP4 0.0.0.0
+a=rtcp:9 IN IP4 0.0.0.0
+a=ice-ufrag:Li6+
+a=ice-pwd:3C05CTZBRQVmGCAq7hVasHlT
+a=ice-options:trickle
+a=fingerprint:sha-256 5B:D3:8E:66:0E:7D:D3:F3:8E:E6:80:28:19:FC:55:AD:58:5D:B9:3D:A8:DE:45:4A:E7:87:02:F8:3C:0B:3B:B3
+a=setup:actpass
+a=mid:0
+a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
+a=recvonly
+a=rtcp-mux
+a=rtpmap:96 VP8/90000
+a=rtcp-fb:96 goog-remb
+a=rtcp-fb:96 transport-cc
+a=rtcp-fb:96 ccm fir
+a=rid:foo recv
+a=rid:bar recv
+a=rid:baz recv
+a=simulcast:recv foo;bar;baz
+`;
+// Tests for the construction of answers with simulcast according to:
+// draft-ietf-mmusic-sdp-simulcast-13
+// draft-ietf-mmusic-rid-15
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const expected_rids = ['foo', 'bar', 'baz'];
+
+ await pc.setRemoteDescription({type: 'offer', sdp: offer_sdp});
+ const transceiver = pc.getTransceivers()[0];
+ // The created transceiver should be in "recvonly" state. Allow it to send.
+ transceiver.direction = 'sendonly';
+ const answer = await pc.createAnswer();
+ const answer_lines = answer.sdp.split('\r\n');
+ // Check for a RID line for each layer.
+ for (const rid of expected_rids) {
+ const result = answer_lines.find(line => line.startsWith(`a=rid:${rid}`));
+ assert_not_equals(result, undefined, `RID attribute for '${rid}' missing.`);
+ }
+
+ // Check for simulcast attribute with send direction and all RIDs.
+ const result = answer_lines.find(
+ line => line.startsWith(`a=simulcast:send ${expected_rids.join(';')}`));
+ assert_not_equals(result, undefined, 'Could not find simulcast attribute.');
+}, 'createAnswer() with multiple send encodings should create simulcast answer');
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const expected_rids = ['foo', 'bar', 'baz'];
+
+ // Try to disable the `bar` encoding in a=simulcast by prefixing it with the
+ // `~` character.
+ await pc.setRemoteDescription({type: 'offer', sdp: offer_sdp.replace(/(a=simulcast:.*)bar/, '$1~bar')});
+ const transceiver = pc.getTransceivers()[0];
+ transceiver.direction = 'sendonly';
+ await pc.setLocalDescription();
+
+ const parameters = pc.getSenders()[0].getParameters();
+ const barEncoding = parameters.encodings.find(encoding => encoding.rid === 'bar');
+ assert_not_equals(barEncoding, undefined);
+ assert_not_equals(barEncoding.active, false);
+}, 'Using the ~rid SDP syntax in a remote offer does not control the local encodings active flag');
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const expected_rids = ['foo', 'bar', 'baz'];
+
+ await pc.setRemoteDescription({type: 'offer', sdp: offer_sdp});
+ const transceiver = pc.getTransceivers()[0];
+ transceiver.direction = 'sendonly';
+ await pc.setLocalDescription();
+
+ // Disabling the encoding should not change the rid to ~rid.
+ const parameters = pc.getSenders()[0].getParameters();
+ parameters.encodings.forEach(e => e.active = false);
+ await pc.getSenders()[0].setParameters(parameters);
+ const offer = await pc.createOffer();
+
+ const offer_lines = offer.sdp.split('\r\n');
+ const result = offer_lines.find(
+ line => line.startsWith(`a=simulcast:send ${expected_rids.join(';')}`));
+ assert_not_equals(result, undefined, 'Could not find simulcast attribute.');
+}, 'Disabling encodings locally does not change the SDP');
+</script>