Bug 1092096 - Separate MSE prefs for MP4 and WebM on a CLOSED TREE. r=cajbir
authorAnthony Jones <ajones@mozilla.com>
Fri, 31 Oct 2014 23:09:49 +1300
changeset 214402 f9fabaacfd6f846a63b98591a68a9566149d88a5
parent 214401 6791ee4cd303ed125ef789a7b4bbb3b973040b92
child 214403 6f32afb5f7c2b000f8eaa3789882a500da9fabbf
push id27780
push userkwierso@gmail.com
push dateFri, 07 Nov 2014 02:25:05 +0000
treeherdermozilla-central@e6d47abb6a7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir
bugs1092096
milestone36.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 1092096 - Separate MSE prefs for MP4 and WebM on a CLOSED TREE. r=cajbir
dom/media/mediasource/MediaSource.cpp
dom/media/test/test_eme_canvas_blocked.html
dom/media/test/test_eme_playback.html
dom/media/test/test_eme_stream_capture_blocked.html
modules/libpref/init/all.js
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -58,53 +58,48 @@ PRLogModuleInfo* GetMediaSourceAPILog()
 #endif
 
 // Arbitrary limit.
 static const unsigned int MAX_SOURCE_BUFFERS = 16;
 
 namespace mozilla {
 
 static const char* const gMediaSourceTypes[6] = {
-// XXX: Disabled other temporarily on desktop to allow WebM testing.  For now,
-// set the developer-only media.mediasource.ignore_codecs pref to true to test
-// other codecs, and expect things to be broken.
-//
-// Disabled WebM in favour of MP4 on Firefox OS.
-#ifdef MOZ_GONK_MEDIACODEC
   "video/mp4",
   "audio/mp4",
-#else
   "video/webm",
   "audio/webm",
-#endif
-#if 0
-  "audio/mpeg",
-#endif
   nullptr
 };
 
 static nsresult
 IsTypeSupported(const nsAString& aType)
 {
   if (aType.IsEmpty()) {
     return NS_ERROR_DOM_INVALID_ACCESS_ERR;
   }
-  if (Preferences::GetBool("media.mediasource.ignore_codecs", false)) {
-    return NS_OK;
-  }
-  // TODO: Further restrict this to formats in the spec.
   nsContentTypeParser parser(aType);
   nsAutoString mimeType;
   nsresult rv = parser.GetType(mimeType);
   if (NS_FAILED(rv)) {
     return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
   }
   bool found = false;
   for (uint32_t i = 0; gMediaSourceTypes[i]; ++i) {
     if (mimeType.EqualsASCII(gMediaSourceTypes[i])) {
+      if ((mimeType.EqualsASCII("video/mp4") ||
+           mimeType.EqualsASCII("audio/mp4")) &&
+          !Preferences::GetBool("media.mediasource.mp4.enabled", false)) {
+        break;
+      }
+      if ((mimeType.EqualsASCII("video/webm") ||
+           mimeType.EqualsASCII("audio/webm")) &&
+          !Preferences::GetBool("media.mediasource.webm.enabled", false)) {
+        break;
+      }
       found = true;
       break;
     }
   }
   if (!found) {
     return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
   }
   // Check aType against HTMLMediaElement list of MIME types.  Since we've
--- a/dom/media/test/test_eme_canvas_blocked.html
+++ b/dom/media/test/test_eme_canvas_blocked.html
@@ -44,17 +44,17 @@ function startTest(test, token)
 }
 
 function beginTest() {
   manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],
-  [ "media.mediasource.ignore_codecs", true ],
+  [ "media.mediasource.mp4.enabled", true ],
 ];
 
 if (/Linux/.test(navigator.userAgent) ||
     !document.createElement('video').canPlayType("video/mp4")) {
   // XXX remove once we have mp4 PlatformDecoderModules on all platforms.
   prefs.push([ "media.fragmented-mp4.exposed", true ]);
   prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
 }
--- a/dom/media/test/test_eme_playback.html
+++ b/dom/media/test/test_eme_playback.html
@@ -105,17 +105,17 @@ function testIsTypeSupported()
 
 function beginTest() {
   testIsTypeSupported();
   manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],
-  [ "media.mediasource.ignore_codecs", true ],
+  [ "media.mediasource.mp4.enabled", true ],
 ];
 
 if (/Linux/.test(navigator.userAgent) ||
     !document.createElement('video').canPlayType("video/mp4")) {
   // XXX remove once we have mp4 PlatformDecoderModules on all platforms.
   prefs.push([ "media.fragmented-mp4.exposed", true ]);
   prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
 }
--- a/dom/media/test/test_eme_stream_capture_blocked.html
+++ b/dom/media/test/test_eme_stream_capture_blocked.html
@@ -79,17 +79,17 @@ function startTest(test, token)
 }
 
 function beginTest() {
   manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],
-  [ "media.mediasource.ignore_codecs", true ],
+  [ "media.mediasource.mp4.enabled", true ],
 ];
 
 if (/Linux/.test(navigator.userAgent) ||
     !document.createElement('video').canPlayType("video/mp4")) {
   // XXX remove once we have mp4 PlatformDecoderModules on all platforms.
   prefs.push([ "media.fragmented-mp4.exposed", true ]);
   prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
 }
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -415,16 +415,24 @@ pref("media.track.enabled", false);
 
 // Whether to enable MediaSource support
 #ifdef RELEASE_BUILD
 pref("media.mediasource.enabled", false);
 #else
 pref("media.mediasource.enabled", true);
 #endif
 
+#ifdef MOZ_WIDGET_GONK
+pref("media.mediasource.mp4.enabled", false);
+pref("media.mediasource.webm.enabled", false);
+#else
+pref("media.mediasource.mp4.enabled", false);
+pref("media.mediasource.webm.enabled", true);
+#endif
+
 #ifdef MOZ_WEBSPEECH
 pref("media.webspeech.recognition.enable", false);
 pref("media.webspeech.synth.enabled", false);
 #endif
 #ifdef MOZ_WEBM_ENCODER
 pref("media.encoder.webm.enabled", true);
 #endif
 #ifdef MOZ_OMX_ENCODER