Bug 1040346: Basic webrtc smoketests for GMP fake H.264 plugin (disabled in automation) r=drno
authorRandell Jesup <rjesup@jesup.org>
Sun, 20 Jul 2014 17:39:19 -0400
changeset 217136 ce030325f21ceb80ac5c7e1db9d433517048d79a
parent 217135 662c3668db6e5a86948f7de258309e77b581c14e
child 217137 41818430febe26dd7b5c4d1132ac35b7d4b504ad
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1040346
milestone33.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 1040346: Basic webrtc smoketests for GMP fake H.264 plugin (disabled in automation) r=drno
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/pc.js
dom/media/tests/mochitest/test_peerConnection_basicH264Video.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -58,16 +58,19 @@ skip-if = toolkit == 'gonk' # b2g(Bug 96
 [test_peerConnection_basicAudioVideoCombined.html]
 skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
 [test_peerConnection_basicVideo.html]
 skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
 [test_peerConnection_basicScreenshare.html]
 skip-if = toolkit == 'gonk' || toolkit == 'android' # no screenshare on b2g/android
 [test_peerConnection_basicWindowshare.html]
 skip-if = toolkit == 'gonk' || toolkit == 'android' # no windowshare on b2g/android
+[test_peerConnection_basicH264Video.html]
+skip-if = true # disabled until we can resolve plugin installation issues
+#skip-if = toolkit == 'gonk' || toolkit == 'android' # no openh264 on b2g/android
 [test_peerConnection_bug822674.html]
 [test_peerConnection_bug825703.html]
 [test_peerConnection_bug827843.html]
 skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
 [test_peerConnection_bug834153.html]
 [test_peerConnection_bug835370.html]
 [test_peerConnection_bug1013809.html]
 skip-if = (toolkit == 'gonk' && debug) # b2g emulator seems to be too slow (Bug 1016498 and 1008080)
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -352,16 +352,29 @@ MediaElementChecker.prototype = {
  * Only calls info() if SimpleTest.info() is available
  */
 function safeInfo(message) {
   if (typeof(info) === "function") {
     info(message);
   }
 }
 
+// Also remove mode 0 if it's offered
+// Note, we don't bother removing the fmtp lines, which makes a good test
+// for some SDP parsing issues.
+function removeVP8(sdp) {
+  var updated_sdp = sdp.replace("a=rtpmap:120 VP8/90000\r\n","");
+  updated_sdp = updated_sdp.replace("RTP/SAVPF 120 126 97\r\n","RTP/SAVPF 126 97\r\n");
+  updated_sdp = updated_sdp.replace("RTP/SAVPF 120 126\r\n","RTP/SAVPF 126\r\n");
+  updated_sdp = updated_sdp.replace("a=rtcp-fb:120 nack\r\n","");
+  updated_sdp = updated_sdp.replace("a=rtcp-fb:120 nack pli\r\n","");
+  updated_sdp = updated_sdp.replace("a=rtcp-fb:120 ccm fir\r\n","");
+  return updated_sdp;
+}
+
 /**
  * Query function for determining if any IP address is available for
  * generating SDP.
  *
  * @return false if required additional network setup.
  */
 function isNetworkReady() {
   // for gonk platform
@@ -519,22 +532,22 @@ function PeerConnectionTest(options) {
       }
       if (!options.config_remote.hasOwnProperty("iceServers")) {
         options.config_remote.iceServers = turnServers.remote.iceServers;
       }
     }
   }
 
   if (options.is_local)
-    this.pcLocal = new PeerConnectionWrapper('pcLocal', options.config_local);
+    this.pcLocal = new PeerConnectionWrapper('pcLocal', options.config_local, options.h264);
   else
     this.pcLocal = null;
 
   if (options.is_remote)
-    this.pcRemote = new PeerConnectionWrapper('pcRemote', options.config_remote || options.config_local);
+    this.pcRemote = new PeerConnectionWrapper('pcRemote', options.config_remote || options.config_local, options.h264);
   else
     this.pcRemote = null;
 
   // Create command chain instance and assign default commands
   this.chain = new CommandChain(this, options.commands);
   if (!options.is_local) {
     this.chain.filterOut(/^PC_LOCAL/);
   }
@@ -1338,31 +1351,33 @@ DataChannelWrapper.prototype = {
  * This class acts as a wrapper around a PeerConnection instance.
  *
  * @constructor
  * @param {string} label
  *        Description for the peer connection instance
  * @param {object} configuration
  *        Configuration for the peer connection instance
  */
-function PeerConnectionWrapper(label, configuration) {
+function PeerConnectionWrapper(label, configuration, h264) {
   this.configuration = configuration;
   this.label = label;
   this.whenCreated = Date.now();
 
   this.constraints = [ ];
   this.offerConstraints = {};
   this.streams = [ ];
   this.mediaCheckers = [ ];
 
   this.dataChannels = [ ];
 
   this.onAddStreamFired = false;
   this.addStreamCallbacks = {};
 
+  this.h264 = typeof h264 !== "undefined" ? true : false;
+
   info("Creating " + this);
   this._pc = new mozRTCPeerConnection(this.configuration);
 
   /**
    * Setup callback handlers
    */
   var self = this;
   // This enables tests to validate that the next ice state is the one they expect to happen
@@ -1612,16 +1627,20 @@ PeerConnectionWrapper.prototype = {
    *        Callback to execute if the offer was created successfully
    */
   createOffer : function PCW_createOffer(onSuccess) {
     var self = this;
 
     this._pc.createOffer(function (offer) {
       info("Got offer: " + JSON.stringify(offer));
       self._last_offer = offer;
+      if (self.h264) {
+        isnot(offer.sdp.search("H264/90000"), -1, "H.264 should be present in the SDP offer");
+        offer.sdp = removeVP8(offer.sdp);
+      }
       onSuccess(offer);
     }, generateErrorCallback(), this.offerConstraints);
   },
 
   /**
    * Creates an answer and automatically handles the failure case.
    *
    * @param {function} onSuccess
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_peerConnection_basicH264Video.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="head.js"></script>
+  <script type="application/javascript" src="mediaStreamPlayback.js"></script>
+  <script type="application/javascript" src="pc.js"></script>
+  <script type="application/javascript" src="templates.js"></script>
+  <script type="application/javascript" src="turnConfig.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript;version=1.8">
+  createHTML({
+    bug: "1040346",
+    title: "Basic H.264 GMP video-only peer connection"
+  });
+
+  var test;
+  runNetworkTest(function (options) {
+    options = options || { };
+    options.h264 = true;
+    test = new PeerConnectionTest(options);
+    test.setMediaConstraints([{video: true}], [{video: true}]);
+    test.run();
+  });
+</script>
+</pre>
+</body>
+</html>