Bug 1207429: P2. Enable FFmpeg by default if available. r=kentuckyfriedtakahe a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 15 Oct 2015 16:10:27 +1100
changeset 298177 cfa20e34ebeee168379e9d9690d4f19478e6294c
parent 298176 bc89c77770dfef60767be4f98fb73fee2f243d2c
child 298178 743dd7362602126e385f0576e79ff15ad50488a9
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe, lizzard
bugs1207429
milestone43.0a2
Bug 1207429: P2. Enable FFmpeg by default if available. r=kentuckyfriedtakahe a=lizzard
dom/media/fmp4/MP4Decoder.cpp
modules/libpref/init/all.js
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -20,16 +20,20 @@
 #include "mozilla/WindowsVersion.h"
 #endif
 #ifdef MOZ_WIDGET_ANDROID
 #include "nsIGfxInfo.h"
 #include "AndroidBridge.h"
 #endif
 #include "mozilla/layers/LayersTypes.h"
 
+#ifdef MOZ_FFMPEG
+#include "FFmpegRuntimeLinker.h"
+#endif
+
 namespace mozilla {
 
 #if defined(MOZ_GONK_MEDIACODEC) || defined(XP_WIN) || defined(MOZ_APPLEMEDIA) || defined(MOZ_FFMPEG)
 #define MP4_READER_DORMANT_HEURISTIC
 #else
 #undef MP4_READER_DORMANT_HEURISTIC
 #endif
 
@@ -179,17 +183,21 @@ MP4Decoder::CanHandleMediaType(const nsA
 }
 
 static bool
 IsFFmpegAvailable()
 {
 #ifndef MOZ_FFMPEG
   return false;
 #else
-  return Preferences::GetBool("media.fragmented-mp4.ffmpeg.enabled", false);
+  if (!Preferences::GetBool("media.fragmented-mp4.ffmpeg.enabled", false)) {
+    return  false;
+  }
+  nsRefPtr<PlatformDecoderModule> m = FFmpegRuntimeLinker::CreateDecoderModule();
+  return !!m;
 #endif
 }
 
 static bool
 IsAppleAvailable()
 {
 #ifndef MOZ_APPLEMEDIA
   // Not the right platform.
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -310,17 +310,17 @@ pref("media.decoder.heuristic.dormant.ti
 #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", false);
+pref("media.fragmented-mp4.ffmpeg.enabled", true);
 pref("media.fragmented-mp4.gmp.enabled", false);
 // Specifies whether the fragmented MP4 parser uses a test decoder that
 // just outputs blank frames/audio instead of actually decoding. The blank
 // decoder works on all platforms.
 pref("media.fragmented-mp4.use-blank-decoder", false);
 #endif
 #ifdef MOZ_RAW
 pref("media.raw.enabled", true);