Bug 1221837: (WIP) test case which reproduces the problem draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Sun, 15 Nov 2015 23:26:46 -0800
changeset 308982 1053ca7ea2c2b83495cb4e492992f38eee2a9819
parent 308981 bc74dbdea094059d5f1d353a2585b4f6352b6ec4
child 511231 1ed31659de24e1ab3076dbade99dabceb93fecd7
push id7545
push userdrno@ohlmeier.org
push dateMon, 16 Nov 2015 07:27:15 +0000
bugs1221837
milestone45.0a1
Bug 1221837: (WIP) test case which reproduces the problem
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/pc.js
dom/media/tests/mochitest/sdpUtils.js
dom/media/tests/mochitest/test_peerConnection_basicAudioPcmaPcmuOnly.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -67,16 +67,18 @@ skip-if = (toolkit == 'gonk' || buildapp
 [test_getUserMedia_stopVideoStreamWithFollowupVideo.html]
 [test_getUserMedia_peerIdentity.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing slow on b2g)
 [test_peerConnection_addIceCandidate.html]
 [test_peerConnection_basicAudio.html]
 skip-if = toolkit == 'gonk' # B2G emulator is too slow to handle a two-way audio call reliably
 [test_peerConnection_basicAudioRequireEOC.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
+[test_peerConnection_basicAudioPcmaPcmuOnly.html]
+skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
 [test_peerConnection_basicAudioVideo.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudioVideoCombined.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudioVideoNoBundle.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudioVideoNoBundleNoRtcpMux.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version == '18' # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -57,16 +57,17 @@ function PeerConnectionTest(options) {
   options = options || { };
   options.commands = options.commands || makeDefaultCommands();
   options.is_local = "is_local" in options ? options.is_local : true;
   options.is_remote = "is_remote" in options ? options.is_remote : true;
 
   options.h264 = "h264" in options ? options.h264 : false;
   options.bundle = "bundle" in options ? options.bundle : true;
   options.rtcpmux = "rtcpmux" in options ? options.rtcpmux : true;
+  options.opus = "opus" in options ? options.opus : true;
 
   if (typeof turnServers !== "undefined") {
     if ((!options.turn_disabled_local) && (turnServers.local)) {
       if (!options.hasOwnProperty("config_local")) {
         options.config_local = {};
       }
       if (!options.config_local.hasOwnProperty("iceServers")) {
         options.config_local.iceServers = turnServers.local.iceServers;
--- a/dom/media/tests/mochitest/sdpUtils.js
+++ b/dom/media/tests/mochitest/sdpUtils.js
@@ -40,16 +40,24 @@ removeVP8: function(sdp) {
 removeRtcpMux: function(sdp) {
   return sdp.replace(/a=rtcp-mux\r\n/g,"");
 },
 
 removeBundle: function(sdp) {
   return sdp.replace(/a=group:BUNDLE .*\r\n/g, "");
 },
 
+reduceAudioMLineToPcmuPcma: function(sdp) {
+  return sdp.replace(/m=audio .*\r\n/g, "m=audio 9 UDP/TLS/RTP/SAVPF 0 8\r\n");
+},
+
+removeAllRtpMaps: function(sdp) {
+  return sdp.replace(/a=rtpmap:.*\r\n/g, "");
+},
+
 verifySdp: function(desc, expectedType, offerConstraintsList, offerOptions,
                     testOptions) {
   info("Examining this SessionDescription: " + JSON.stringify(desc));
   info("offerConstraintsList: " + JSON.stringify(offerConstraintsList));
   info("offerOptions: " + JSON.stringify(offerOptions));
   ok(desc, "SessionDescription is not null");
   is(desc.type, expectedType, "SessionDescription type is " + expectedType);
   ok(desc.sdp.length > 10, "SessionDescription body length is plausible");
@@ -71,17 +79,17 @@ verifySdp: function(desc, expectedType, 
       sdputils.countTracksInConstraint('audio', offerConstraintsList) ||
       ((offerOptions && offerOptions.offerToReceiveAudio) ? 1 : 0);
 
   info("expected audio tracks: " + audioTracks);
   if (audioTracks == 0) {
     ok(!desc.sdp.includes("m=audio"), "audio m-line is absent from SDP");
   } else {
     ok(desc.sdp.includes("m=audio"), "audio m-line is present in SDP");
-    ok(desc.sdp.includes("a=rtpmap:109 opus/48000/2"), "OPUS codec is present in SDP");
+    is(testOptions.opus, desc.sdp.includes("a=rtpmap:109 opus/48000/2"), "OPUS codec is present in SDP");
     //TODO: ideally the rtcp-mux should be for the m=audio, and not just
     //      anywhere in the SDP (JS SDP parser bug 1045429)
     is(testOptions.rtcpmux, desc.sdp.includes("a=rtcp-mux"), "RTCP Mux is offered in SDP");
   }
 
   var videoTracks =
       sdputils.countTracksInConstraint('video', offerConstraintsList) ||
       ((offerOptions && offerOptions.offerToReceiveVideo) ? 1 : 0);
copy from dom/media/tests/mochitest/test_peerConnection_basicAudio.html
copy to dom/media/tests/mochitest/test_peerConnection_basicAudioPcmaPcmuOnly.html
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioPcmaPcmuOnly.html
@@ -3,21 +3,32 @@
 <head>
   <script type="application/javascript" src="pc.js"></script>
 </head>
 <body>
 <pre id="test">
 <script type="application/javascript">
   createHTML({
     bug: "796892",
-    title: "Basic audio-only peer connection"
+    title: "Only offer PCMA and PMCU in mline (no rtpmaps)"
   });
 
   var test;
   runNetworkTest(function (options) {
+    options = options || { };
+    options.opus = false;
     test = new PeerConnectionTest(options);
+    test.chain.insertBefore("PC_REMOTE_GET_OFFER", [
+      function PC_LOCAL_REDUCE_MLINE_REMOVE_RTPMAPS(test) {
+        test.originalOffer.sdp =
+          sdputils.reduceAudioMLineToPcmuPcma(test.originalOffer.sdp);
+        test.originalOffer.sdp =
+          sdputils.removeAllRtpMaps(test.originalOffer.sdp);
+        info("SDP without Rtpmaps: " + JSON.stringify(test.originalOffer));
+      }
+    ]);
     test.setMediaConstraints([{audio: true}], [{audio: true}]);
     test.run();
   });
 </script>
 </pre>
 </body>
 </html>