Bug 1159171 - Enable ffmpeg on Linux platforms for media mochitests. r=jya draft
authorJW Wang <jwwang@mozilla.com>
Tue, 28 Apr 2015 02:27:00 +1000
changeset 607024 ee0c145bb8545ab738facf4b5309ad8a1ccfdd94
parent 607023 8fd2ae9e68c96c078e9abc58dff0e3a0f80e292e
child 607025 d82c738bdd5401068d08b6df196d2616a9ced23c
push id93006
push userjyavenard@mozilla.com
push dateThu, 15 Oct 2015 05:15:33 +0000
treeherdertry@45ea2a01301e [default view] [failures only]
reviewersjya
bugs1159171
milestone43.0a2
Bug 1159171 - Enable ffmpeg on Linux platforms for media mochitests. r=jya
dom/media/test/eme.js
dom/media/test/test_can_play_type_mpeg.html
testing/profiles/prefs_general.js
--- a/dom/media/test/eme.js
+++ b/dom/media/test/eme.js
@@ -397,18 +397,16 @@ function SetupEME(test, token, params)
 }
 
 function SetupEMEPref(callback) {
   var prefs = [
     [ "media.mediasource.enabled", true ],
     [ "media.eme.apiVisible", true ],
   ];
 
-  if (/Linux/.test(manifestNavigator().userAgent)) {
-    prefs.push([ "media.fragmented-mp4.ffmpeg.enabled", true ]);
-  } else if (SpecialPowers.Services.appinfo.name == "B2G" ||
-             !manifestVideo().canPlayType("video/mp4")) {
-   // XXX remove once we have mp4 PlatformDecoderModules on all platforms.
-   prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
+  if (SpecialPowers.Services.appinfo.name == "B2G" ||
+      !manifestVideo().canPlayType("video/mp4")) {
+    // XXX remove once we have mp4 PlatformDecoderModules on all platforms.
+    prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
   }
 
   SpecialPowers.pushPrefEnv({ "set" : prefs }, callback);
 }
--- a/dom/media/test/test_can_play_type_mpeg.html
+++ b/dom/media/test/test_can_play_type_mpeg.html
@@ -41,24 +41,22 @@ function check_mp4(v, enabled) {
   check("video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"", "probably");
 
   // H.264 Constrained Baseline Profile Level 3.0, mp3
   check("video/mp4; codecs=\"avc1.42E01E, mp3\"", "probably");
 
   check("video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"", "probably");
   check("video/mp4; codecs=\"avc1.58A01E, mp4a.40.2\"", "probably");
 
-  const ProbablyIfNotLinux = !IsLinuxGStreamer() ? "probably" : "";
-
   // H.264 Main Profile Level 3.0, AAC-LC
   check("video/mp4; codecs=\"avc1.4D401E, mp4a.40.2\"", "probably");
   // H.264 Main Profile Level 3.1, AAC-LC
-  check("video/mp4; codecs=\"avc1.4D401F, mp4a.40.2\"", ProbablyIfNotLinux);
+  check("video/mp4; codecs=\"avc1.4D401F, mp4a.40.2\"", "probably");
   // H.264 Main Profile Level 4.0, AAC-LC
-  check("video/mp4; codecs=\"avc1.4D4028, mp4a.40.2\"", ProbablyIfNotLinux);
+  check("video/mp4; codecs=\"avc1.4D4028, mp4a.40.2\"", "probably");
   // H.264 High Profile Level 3.0, AAC-LC
   check("video/mp4; codecs=\"avc1.64001E, mp4a.40.2\"", "probably");
   // H.264 High Profile Level 3.1, AAC-LC
   check("video/mp4; codecs=\"avc1.64001F, mp4a.40.2\"", "probably");
 
   check("video/mp4; codecs=\"avc1.42E01E\"", "probably");
   check("video/mp4; codecs=\"avc1.42001E\"", "probably");
   check("video/mp4; codecs=\"avc1.58A01E\"", "probably");
@@ -67,20 +65,20 @@ function check_mp4(v, enabled) {
 
   // AAC-LC
   check("audio/mp4; codecs=\"mp4a.40.2\"", "probably");
   check("audio/mp4; codecs=mp4a.40.2", "probably");
   check("audio/x-m4a; codecs=\"mp4a.40.2\"", "probably");
   check("audio/x-m4a; codecs=mp4a.40.2", "probably");
 
   // HE-AAC v1
-  check("audio/mp4; codecs=\"mp4a.40.5\"", ProbablyIfNotLinux);
-  check("audio/mp4; codecs=mp4a.40.5", ProbablyIfNotLinux);
-  check("audio/x-m4a; codecs=\"mp4a.40.5\"", ProbablyIfNotLinux);
-  check("audio/x-m4a; codecs=mp4a.40.5", ProbablyIfNotLinux);
+  check("audio/mp4; codecs=\"mp4a.40.5\"", "probably");
+  check("audio/mp4; codecs=mp4a.40.5", "probably");
+  check("audio/x-m4a; codecs=\"mp4a.40.5\"", "probably");
+  check("audio/x-m4a; codecs=mp4a.40.5", "probably");
 
 }
 
 function check_mp3(v, enabled) {
   function check(type, expected) {
     var ex = enabled ? expected : "";
     is(v.canPlayType(type), ex, type + "='" + ex + "'");
   }
@@ -115,21 +113,16 @@ function IsMacOSSnowLeopardOrLater() {
 function getPref(name) {
   var pref = false;
   try {
     pref = SpecialPowers.getBoolPref(name);
   } catch(ex) { }
   return pref;
 }
 
-function IsLinuxGStreamer() {
-  return /Linux/.test(navigator.userAgent) &&
-         getPref("media.gstreamer.enabled");
-}
-
 function IsJellyBeanOrLater() {
   return androidVersion >= 16;
 }
 
 // Check whether we should expect the new MP4Reader-based support to work.
 function IsMP4ReaderAvailable() {
   var prefs = getPref("media.fragmented-mp4.enabled");
   return prefs && (IsWindowsVistaOrLater() || IsMacOSSnowLeopardOrLater() || IsJellyBeanOrLater());
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -162,16 +162,23 @@ user_pref("layout.css.unicode-range.enab
 
 // Disable spammy layout warnings because they pollute test logs
 user_pref("layout.spammy_warnings.enabled", false);
 
 // Enable Media Source Extensions for testing
 user_pref("media.mediasource.mp4.enabled", true);
 user_pref("media.mediasource.webm.enabled", true);
 
+// Enable fragmented MP4 parser for testing
+user_pref("media.fragmented-mp4.exposed", true);
+
+#if defined(LINUX)
+user_pref("media.fragmented-mp4.ffmpeg.enabled", true);
+#endif
+
 // Enable mozContacts
 user_pref("dom.mozContacts.enabled", true);
 
 // Enable mozSettings
 user_pref("dom.mozSettings.enabled", true);
 
 // Make sure the disk cache doesn't get auto disabled
 user_pref("network.http.bypass-cachelock-threshold", 200000);