Bug 1207429: P2. Enable FFmpeg by default if available. r=kentuckyfriedtakahe draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 15 Oct 2015 16:10:27 +1100
changeset 607023 8fd2ae9e68c96c078e9abc58dff0e3a0f80e292e
parent 607022 dfb4633ba5fe4244a65e1712609a462d4ad79a23
child 607024 ee0c145bb8545ab738facf4b5309ad8a1ccfdd94
push id93006
push userjyavenard@mozilla.com
push dateThu, 15 Oct 2015 05:15:33 +0000
treeherdertry@45ea2a01301e [default view] [failures only]
reviewerskentuckyfriedtakahe
bugs1207429
milestone43.0a2
Bug 1207429: P2. Enable FFmpeg by default if available. r=kentuckyfriedtakahe
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);