Bug 1439736 - AudioLevel RTP header ext. send/recv mochitest. r=mjf, a=RyanVM
authorNico Grunbaum
Tue, 20 Feb 2018 12:46:38 -0800
changeset 455011 4c965e8fc803b9eff98c9bfa57c7f238ba8c92e9
parent 455010 7e8036db9669d79cdfbf20fdf68447c4bef60179
child 455012 17c5d6591ddef2166d1fe7785d9f9f859e79ac98
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjf, RyanVM
bugs1439736
milestone59.0
Bug 1439736 - AudioLevel RTP header ext. send/recv mochitest. r=mjf, a=RyanVM MozReview-Commit-ID: 2ybzJSSS7Jb
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/test_peerConnection_audioSynchronizationSourcesUnidirectional.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -101,16 +101,18 @@ skip-if = android_version == '18' # andr
 [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') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudio.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [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)
 [test_peerConnection_basicAudioNATSrflx.html]
 skip-if = toolkit == 'android' || (os == 'linux' && (debug || asan)) # websockets don't work on android (bug 1266217), linux hang (bug 1339568)
 [test_peerConnection_basicAudioNATRelay.html]
 skip-if = toolkit == 'android' || (os == 'linux' && (debug || asan)) # websockets don't work on android (bug 1266217), linux hang (bug 1339568)
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_peerConnection_audioSynchronizationSourcesUnidirectional.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <script type="application/javascript" src="pc.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+  createHTML({
+    bug: "1439001",
+    title: "Test audio unidirectional getSynchronizationSources"
+  });
+
+  var waitForSyncSources = async (test) => {
+    let receiver = test.pcRemote.getReceivers()[0];
+    ok(receiver, "Remote has a receiver");
+    // Wait for remote sync source
+    while (receiver.getSynchronizationSources().length == 0) {
+      await wait(250);
+    }
+    is(receiver.getSynchronizationSources().length, 1,
+       "Remote receiver has a synchronization source");
+    // Make sure local has no sync source
+    is(test.pcLocal.getReceivers()[0].getSynchronizationSources().length, 0,
+       "Local receiver has no synchronization source");
+  };
+  /*
+   * Test to make sure that in unidirectional calls, the receiving end has
+   * synchronization sources with audio levels, and the sending end has none.
+   */
+  var testGetSynchronizationSourcesUnidirectional = async (test) => {
+    await waitForSyncSources(test);
+    let receiver = test.pcRemote.getReceivers()[0];
+    let syncSources = receiver.getSynchronizationSources();
+    ok(syncSources.length > 0,
+       "Receiver has Synchronization sources " + JSON.stringify(syncSources));
+    is(syncSources.length, 1, "Receiver has only a single sync source");
+    let syncSource = syncSources[0];
+    ok(syncSource.audioLevel !== undefined, "SynchronizationSource has audioLevel");
+  };
+
+  var test;
+  runNetworkTest(function(options) {
+    test = new PeerConnectionTest(options);
+    test.chain.insertAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW",
+      [testGetSynchronizationSourcesUnidirectional]);
+    test.setMediaConstraints([{audio: true}], []);
+    test.pcLocal.audioElementsOnly = true;
+    test.run();
+  });
+</script>
+</pre>
+</body>
+</html>