summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.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 /dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.html')
-rw-r--r--dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.html
new file mode 100644
index 0000000000..bde51c1fd0
--- /dev/null
+++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_telephoneEventFirst.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" src="pc.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+createHTML({
+ title: "RTCPeerConnection with telephone-event codec first in SDP",
+ bug: "1581898",
+ visible: true
+});
+
+const test = async () => {
+ const pc1 = new RTCPeerConnection();
+ const pc2 = new RTCPeerConnection();
+ const stream = await navigator.mediaDevices.getUserMedia({audio:true});
+ pc1.addTrack(stream.getAudioTracks()[0], stream);
+ pc2.addTrack(stream.getAudioTracks()[0], stream);
+
+ const offer = await pc1.createOffer();
+ await pc1.setLocalDescription(offer);
+
+ const regex = /^(m=audio \d+ [^ ]+) (.*) 101(.*)$/m;
+
+ // Rewrite offer so payload type 101 comes first
+ offer.sdp = offer.sdp.replace(regex, '$1 101 $2 $3');
+
+ ok(offer.sdp.match(/^m=audio \d+ [^ ]+ 101 /m),
+ "Payload type 101 should be first on the m-line");
+
+ await pc2.setRemoteDescription(offer);
+ const answer = await pc2.createAnswer();
+
+ pc1.onicecandidate = e => { pc2.addIceCandidate(e.candidate); }
+ pc2.onicecandidate = e => { pc1.addIceCandidate(e.candidate); }
+
+ await pc1.setRemoteDescription(answer);
+ await pc2.setLocalDescription(answer);
+ await new Promise(resolve => {
+ pc1.oniceconnectionstatechange = e => {
+ if (pc1.iceConnectionState == "connected") {
+ resolve();
+ }
+ };
+ });
+ await wait(1000);
+};
+
+runNetworkTest(test);
+
+</script>
+</pre>
+</body>
+</html>