Bug 1437366 - Test that sending and receiving audio when using a graph with a sample-rate that is not supported by the MediaPipeline code works. r=pehrsons
authorPaul Adenot <paul@paul.cx>
Mon, 05 Mar 2018 14:53:09 +0100
changeset 409027 b36537851ae16a27ca4f55676ed469a94e5d96cc
parent 409026 dfabe184b3677d87c55eb9e92f04a6a49f6dbc29
child 409028 1bc2b82918bde446c2759f15e0b7397b50ed4641
push id33671
push usercsabou@mozilla.com
push dateTue, 20 Mar 2018 22:23:32 +0000
treeherdermozilla-central@e2e874ceae78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1437366
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1437366 - Test that sending and receiving audio when using a graph with a sample-rate that is not supported by the MediaPipeline code works. r=pehrsons MozReview-Commit-ID: 4c5zgkYCX2T
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/peerconnection_audio_forced_sample_rate.js
dom/media/tests/mochitest/test_peerConnection_basicAudio_forced_higher_rate.html
dom/media/tests/mochitest/test_peerConnection_basicAudio_forced_lower_rate.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -10,16 +10,17 @@ support-files =
   pc.js
   templates.js
   NetworkPreparationChromeScript.js
   blacksilence.js
   turnConfig.js
   sdpUtils.js
   addTurnsSelfsignedCert.js
   parser_rtp.js
+  peerconnection_audio_forced_sample_rate.js
   !/dom/canvas/test/captureStream_common.js
   !/dom/canvas/test/webgl-mochitest/webgl-util.js
   !/dom/media/test/manifest.js
   !/dom/media/test/320x240.ogv
   !/dom/media/test/r11025_s16_c1.wav
   !/dom/media/test/bug461281.ogg
   !/dom/media/test/seek.webm
   !/dom/media/test/gizmo.mp4
@@ -99,16 +100,18 @@ skip-if = toolkit == 'android' # no scre
 [test_peerConnection_addtrack_removetrack_events.html]
 skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_audioCodecs.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_transceivers.html]
 skip-if = (android_version == '18') || (os == 'linux' && debug) # android(Bug 1189784, timeouts on 4.3 emulator), Bug 1432025
 [test_peerConnection_basicAudio.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
+[test_peerConnection_basicAudio_forced_lower_rate.html]
+[test_peerConnection_basicAudio_forced_higher_rate.html]
 [test_peerConnection_audioSynchronizationSources.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_audioSynchronizationSourcesUnidirectional.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_audioContributingSources.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_checkPacketDumpHook.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/peerconnection_audio_forced_sample_rate.js
@@ -0,0 +1,38 @@
+// This function takes a sample-rate, and tests that audio flows correctly when
+// the sampling-rate at which the MSG runs is not one of the sampling-rates that
+// the MediaPipeline can work with.
+// It is in a separate file because we have an MSG per document, and we want to
+// test multiple sample-rates, so we include it in multiple HTML mochitest
+// files.
+function test_peerconnection_audio_forced_sample_rate(forcedSampleRate) {
+  scriptsReady.then(function () {
+    pushPrefs(
+      ["media.cubeb.force_sample_rate", forcedSampleRate]
+    ).then(function () {
+      runNetworkTest(function (options) {
+        let test = new PeerConnectionTest(options);
+        let ac = new AudioContext();
+        test.setMediaConstraints([{
+          audio: true
+        }], []);
+        test.chain.replace("PC_LOCAL_GUM", [
+          function PC_LOCAL_WEBAUDIO_SOURCE(test) {
+            let oscillator = ac.createOscillator();
+            oscillator.type = 'sine';
+            oscillator.frequency.value = 700;
+            oscillator.start();
+            let dest = ac.createMediaStreamDestination();
+            oscillator.connect(dest);
+            test.pcLocal.attachLocalStream(dest.stream);
+          }
+        ]);
+        test.chain.append([
+          function CHECK_REMOTE_AUDIO_FLOW(test) {
+            return test.pcRemote.checkReceivingToneFrom(ac, test.pcLocal);
+          }
+        ]);
+        test.run();
+      });
+    });
+  })
+}
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudio_forced_higher_rate.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <script type="application/javascript" src="pc.js"></script>
+  <script type="application/javascript" src="peerconnection_audio_forced_sample_rate.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+  createHTML({
+    bug: "1437366",
+    title: "Basic audio-only peer connection, with the MSG running at a rate not supported by the MediaPipeline (96000Hz)"
+  });
+
+  test_peerconnection_audio_forced_sample_rate(96000);
+
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudio_forced_lower_rate.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <script type="application/javascript" src="pc.js"></script>
+  <script type="application/javascript" src="peerconnection_audio_forced_sample_rate.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+  createHTML({
+    bug: "1437366",
+    title: "Basic audio-only peer connection, with the MSG running at a rate not supported by the MediaPipeline (24000Hz)"
+  });
+
+test_peerconnection_audio_forced_sample_rate(24000);
+
+</script>
+</pre>
+</body>
+</html>