Bug 1214932 - Remove fragmented-mp4 from media prefs. r=jya
authorChris Pearce <cpearce@mozilla.com>
Thu, 15 Oct 2015 14:51:28 +1300
changeset 301200 a32795633bff04b81b1fb0d7303ac8b416fa3558
parent 301199 075de7ffc6450a6d0988f70382dfb70fe4b51f93
child 301201 d565e8609c4e4f2687e1fd87a27b90fff40b892f
push idunknown
push userunknown
push dateunknown
reviewersjya
bugs1214932
milestone44.0a1
Bug 1214932 - Remove fragmented-mp4 from media prefs. r=jya
b2g/app/b2g.js
browser/app/profile/firefox.js
dom/media/fmp4/MP4Decoder.cpp
dom/media/gtest/TestMP4Reader.cpp
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/PlatformDecoderModule.h
dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
dom/media/test/eme.js
dom/media/test/test_can_play_type_mpeg.html
dom/media/test/test_gmp_playback.html
mobile/android/app/mobile.js
mobile/android/b2gdroid/app/b2gdroid.js
modules/libpref/init/all.js
testing/profiles/prefs_general.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -314,17 +314,17 @@ pref("media.preload.auto", 2);    // pre
 pref("media.cache_size", 4096);    // 4MB media cache
 // Try to save battery by not resuming reading from a connection until we fall
 // below 10s of buffered data.
 pref("media.cache_resume_threshold", 10);
 pref("media.cache_readahead_limit", 30);
 
 #ifdef MOZ_FMP4
 // Enable/Disable Gonk Decoder Module
-pref("media.fragmented-mp4.gonk.enabled", true);
+pref("media.gonk.enabled", true);
 #endif
 
 //Encrypted media extensions.
 pref("media.eme.enabled", true);
 pref("media.eme.apiVisible", true);
 // The default number of decoded video frames that are enqueued in
 // MediaDecoderReader's mVideoQueue.
 pref("media.video-queue.default-size", 3);
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1830,18 +1830,18 @@ pref("ui.key.menuAccessKeyFocuses", true
 #endif
 
 // Encrypted media extensions.
 pref("media.eme.enabled", true);
 pref("media.eme.apiVisible", true);
 
 // If decoding-via-gmp is turned on for <video>, default to using
 // Adobe's GMP for decoding.
-pref("media.fragmented-mp4.gmp.aac", 2);
-pref("media.fragmented-mp4.gmp.h264", 2);
+pref("media.gmp.decoder.aac", 2);
+pref("media.gmp.decoder.h264", 2);
 
 // Whether we should run a test-pattern through EME GMPs before assuming they'll
 // decode H.264.
 pref("media.gmp.trial-create.enabled", true);
 
 #ifdef MOZ_ADOBE_EME
 pref("browser.eme.ui.enabled", true);
 pref("media.gmp-eme-adobe.enabled", true);
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -171,17 +171,17 @@ MP4Decoder::CanHandleMediaType(const nsA
 
   return CanHandleMediaType(NS_ConvertUTF16toUTF8(mimeType), codecs);
 }
 
 /* static */
 bool
 MP4Decoder::IsEnabled()
 {
-  return Preferences::GetBool("media.fragmented-mp4.enabled");
+  return Preferences::GetBool("media.mp4.enabled");
 }
 
 static const uint8_t sTestH264ExtraData[] = {
   0x01, 0x64, 0x00, 0x0a, 0xff, 0xe1, 0x00, 0x17, 0x67, 0x64,
   0x00, 0x0a, 0xac, 0xd9, 0x44, 0x26, 0x84, 0x00, 0x00, 0x03,
   0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xc8, 0x3c, 0x48, 0x96,
   0x58, 0x01, 0x00, 0x06, 0x68, 0xeb, 0xe3, 0xcb, 0x22, 0xc0
 };
--- a/dom/media/gtest/TestMP4Reader.cpp
+++ b/dom/media/gtest/TestMP4Reader.cpp
@@ -25,17 +25,17 @@ public:
   nsRefPtr<MP4Reader> reader;
 
   explicit TestBinding(const char* aFileName = "gizmo.mp4")
     : decoder(new MP4Decoder())
     , resource(new MockMediaResource(aFileName))
     , reader(new MP4Reader(decoder))
   {
     EXPECT_EQ(NS_OK, Preferences::SetBool(
-                       "media.fragmented-mp4.use-blank-decoder", true));
+                       "media.use-blank-decoder", true));
 
     EXPECT_EQ(NS_OK, resource->Open(nullptr));
     decoder->SetResource(resource);
 
     reader->Init(nullptr);
     // This needs to be done before invoking GetBuffered. This is normally
     // done by MediaDecoderStateMachine.
     reader->DispatchSetStartTime(0);
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -62,32 +62,32 @@ PDMFactory::Init()
   MOZ_ASSERT(NS_IsMainThread());
   static bool alreadyInitialized = false;
   if (alreadyInitialized) {
     return;
   }
   alreadyInitialized = true;
 
   Preferences::AddBoolVarCache(&sUseBlankDecoder,
-                               "media.fragmented-mp4.use-blank-decoder");
+                               "media.use-blank-decoder");
 #ifdef MOZ_GONK_MEDIACODEC
   Preferences::AddBoolVarCache(&sGonkDecoderEnabled,
-                               "media.fragmented-mp4.gonk.enabled", false);
+                               "media.gonk.enabled", false);
 #endif
 #ifdef MOZ_WIDGET_ANDROID
   Preferences::AddBoolVarCache(&sAndroidMCDecoderEnabled,
-                               "media.fragmented-mp4.android-media-codec.enabled", false);
+                               "media.android-media-codec.enabled", false);
   Preferences::AddBoolVarCache(&sAndroidMCDecoderPreferred,
-                               "media.fragmented-mp4.android-media-codec.preferred", false);
+                               "media.android-media-codec.preferred", false);
 #endif
 
   Preferences::AddBoolVarCache(&sGMPDecoderEnabled,
-                               "media.fragmented-mp4.gmp.enabled", false);
+                               "media.gmp.decoder.enabled", false);
   Preferences::AddBoolVarCache(&sFFmpegDecoderEnabled,
-                               "media.fragmented-mp4.ffmpeg.enabled", false);
+                               "media.ffmpeg.enabled", false);
 
   Preferences::AddBoolVarCache(&sEnableFuzzingWrapper,
                                "media.decoder.fuzzing.enabled", false);
   Preferences::AddUintVarCache(&sVideoOutputMinimumInterval_ms,
                                "media.decoder.fuzzing.video-output-minimum-interval-ms", 0);
   Preferences::AddBoolVarCache(&sDontDelayInputExhausted,
                                "media.decoder.fuzzing.dont-delay-inputexhausted", false);
 
--- a/dom/media/platforms/PlatformDecoderModule.h
+++ b/dom/media/platforms/PlatformDecoderModule.h
@@ -37,17 +37,17 @@ class CDMProxy;
 // PlatformDecoderModule to provide access to its decoders in order to get
 // decompressed H.264/AAC from the MediaFormatReader.
 //
 // Decoding is asynchronous, and should be performed on the task queue
 // provided if the underlying platform isn't already exposing an async API.
 //
 // A cross-platform decoder module that discards input and produces "blank"
 // output samples exists for testing, and is created when the pref
-// "media.fragmented-mp4.use-blank-decoder" is true.
+// "media.use-blank-decoder" is true.
 
 class PlatformDecoderModule {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PlatformDecoderModule)
 
   // Perform any per-instance initialization.
   // This is called on the decode task queue.
   virtual nsresult Startup() { return NS_OK; };
--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
@@ -92,19 +92,19 @@ GMPDecoderModule::DecoderNeedsConversion
 static uint32_t sPreferredAacGmp = 0;
 static uint32_t sPreferredH264Gmp = 0;
 
 /* static */
 void
 GMPDecoderModule::Init()
 {
   Preferences::AddUintVarCache(&sPreferredAacGmp,
-                               "media.fragmented-mp4.gmp.aac", 0);
+                               "media.gmp.decoder.aac", 0);
   Preferences::AddUintVarCache(&sPreferredH264Gmp,
-                               "media.fragmented-mp4.gmp.h264", 0);
+                               "media.gmp.decoder.h264", 0);
 }
 
 /* static */
 const Maybe<nsCString>
 GMPDecoderModule::PreferredGMP(const nsACString& aMimeType)
 {
   Maybe<nsCString> rv;
   if (aMimeType.EqualsLiteral("audio/mp4a-latm")) {
--- a/dom/media/test/eme.js
+++ b/dom/media/test/eme.js
@@ -419,13 +419,13 @@ function SetupEMEPref(callback) {
   var prefs = [
     [ "media.mediasource.enabled", true ],
     [ "media.eme.apiVisible", 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 ]);
+    prefs.push([ "media.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
@@ -119,33 +119,29 @@ function getPref(name) {
   } catch(ex) { }
   return pref;
 }
 
 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());
-}
-
-var haveMp4 = IsWindowsVistaOrLater() ||
+var haveMp4 = (getPref("media.wmf.enabled") && IsWindowsVistaOrLater()) ||
+              IsMacOSSnowLeopardOrLater() ||
+              IsJellyBeanOrLater() ||
               getPref("media.omx.enabled") ||
               getPref("media.gstreamer.enabled") ||
-              IsMP4ReaderAvailable();
-// TODO:  Add "getPref("media.plugins.enabled")" once MP4 works on Gingerbread.
+              getPref("media.ffmpeg.enabled");
 
 check_mp4(document.getElementById('v'), haveMp4);
 
 var haveMp3 = getPref("media.directshow.enabled") ||
-              (getPref("media.windows-media-foundation.enabled") && IsWindowsVistaOrLater()) ||
-               getPref("media.gstreamer.enabled") ||
-               getPref("media.apple.mp3.enabled");
+              (getPref("media.wmf.enabled") && IsWindowsVistaOrLater()) ||
+              getPref("media.gstreamer.enabled") ||
+              getPref("media.ffmpeg.enabled") ||
+              getPref("media.apple.mp3.enabled");
 check_mp3(document.getElementById('v'), haveMp3);
 
 mediaTestCleanup();
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/test/test_gmp_playback.html
+++ b/dom/media/test/test_gmp_playback.html
@@ -22,19 +22,19 @@ function startTest() {
     ok(true, "Reached end");
     SimpleTest.finish();
   });
   document.body.appendChild(v);
   v.play();
 }
 
 var testPrefs = [
-  ['media.fragmented-mp4.gmp.aac', 1],  // gmp-clearkey
-  ['media.fragmented-mp4.gmp.h264', 1], // gmp-clearkey
-  ['media.fragmented-mp4.gmp.enabled', true]
+  ['media.gmp.decoder.aac', 1],  // gmp-clearkey
+  ['media.gmp.decoder.h264', 1], // gmp-clearkey
+  ['media.gmp.decoder.enabled', true]
 ];
 
 SpecialPowers.pushPrefEnv({'set': testPrefs}, startTest);
 
 </script>
 </pre>
 </body>
 </html>
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -584,19 +584,18 @@ pref("media.cache_readahead_limit", 30);
 // On Android this is decided by a similar value which varies for
 // each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This
 // number must be less than the OMX equivalent or gecko will think it is
 // chronically starved of video frames. All decoders seen so far have a value
 // of at least 4.
 pref("media.video-queue.default-size", 3);
 
 // Enable the MediaCodec PlatformDecoderModule by default.
-pref("media.fragmented-mp4.enabled", true);
-pref("media.fragmented-mp4.android-media-codec.enabled", true);
-pref("media.fragmented-mp4.android-media-codec.preferred", true);
+pref("media.android-media-codec.enabled", true);
+pref("media.android-media-codec.preferred", true);
 
 // Enable MSE
 pref("media.mediasource.enabled", true);
 
 // optimize images memory usage
 pref("image.downscale-during-decode.enabled", true);
 
 #ifdef NIGHTLY_BUILD
--- a/mobile/android/b2gdroid/app/b2gdroid.js
+++ b/mobile/android/b2gdroid/app/b2gdroid.js
@@ -576,20 +576,18 @@ pref("media.cache_readahead_limit", 30);
 // On Android this is decided by a similar value which varies for
 // each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This
 // number must be less than the OMX equivalent or gecko will think it is
 // chronically starved of video frames. All decoders seen so far have a value
 // of at least 4.
 pref("media.video-queue.default-size", 3);
 
 // Enable the MediaCodec PlatformDecoderModule by default.
-pref("media.fragmented-mp4.exposed", true);
-pref("media.fragmented-mp4.enabled", true);
-pref("media.fragmented-mp4.android-media-codec.enabled", true);
-pref("media.fragmented-mp4.android-media-codec.preferred", true);
+pref("media.android-media-codec.enabled", true);
+pref("media.android-media-codec.preferred", true);
 
 // Enable MSE
 pref("media.mediasource.enabled", true);
 
 // optimize images memory usage
 pref("image.downscale-during-decode.enabled", true);
 
 #ifdef NIGHTLY_BUILD
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -305,33 +305,36 @@ pref("media.play-stand-alone", true);
 // attribute until the media element's owner document is visible.
 pref("media.block-play-until-visible", false);
 
 pref("media.hardware-video-decoding.enabled", true);
 
 pref("media.decoder.heuristic.dormant.enabled", true);
 pref("media.decoder.heuristic.dormant.timeout", 60000);
 
-#ifdef MOZ_WMF
-pref("media.wmf.decoder.thread-count", -1);
-#endif
 #ifdef MOZ_DIRECTSHOW
 pref("media.directshow.enabled", true);
 #endif
 #ifdef MOZ_FMP4
-pref("media.fragmented-mp4.enabled", true);
-pref("media.fragmented-mp4.ffmpeg.enabled", true);
-pref("media.fragmented-mp4.gmp.enabled", false);
-pref("media.fragmented-mp4.gmp.aac", 0);
-pref("media.fragmented-mp4.gmp.h264", 0);
-// Specifies whether the fragmented MP4 parser uses a test decoder that
+pref("media.mp4.enabled", true);
+// Specifies whether the PDMFactory can create a test decoder that
+#endif
 // just outputs blank frames/audio instead of actually decoding. The blank
 // decoder works on all platforms.
-pref("media.fragmented-mp4.use-blank-decoder", false);
+pref("media.use-blank-decoder", false);
+#ifdef MOZ_WMF
+pref("media.wmf.enabled", true);
+pref("media.wmf.decoder.thread-count", -1);
 #endif
+#if defined(MOZ_FFMPEG)
+pref("media.ffmpeg.enabled", true);
+#endif
+pref("media.gmp.decoder.enabled", false);
+pref("media.gmp.decoder.aac", 0);
+pref("media.gmp.decoder.h264", 0);
 #ifdef MOZ_RAW
 pref("media.raw.enabled", true);
 #endif
 pref("media.ogg.enabled", true);
 pref("media.opus.enabled", true);
 #ifdef MOZ_WAVE
 pref("media.wave.enabled", true);
 #endif
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -166,23 +166,16 @@ user_pref("layout.css.prefixes.webkit", 
 
 // 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);