Bug 1206977: P10. Remove redundant code. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 06 Oct 2015 21:03:52 +1100
changeset 300053 ae99d2aca89aebfa6f4a7c3c1c96db27f783f67a
parent 300052 cac2b7df9ea5ef4d3adfc849dc3572b0fb578bf3
child 300054 158dd058323aadb3bd6e62cc456c2209113b5cef
push idunknown
push userunknown
push dateunknown
reviewerscpearce
bugs1206977
milestone44.0a1
Bug 1206977: P10. Remove redundant code. r=cpearce The same checks are performed in the PDMFactory::SupportsMimeType
dom/media/fmp4/MP4Decoder.cpp
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -22,20 +22,16 @@
 #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
-
 #include "PDMFactory.h"
 
 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
@@ -172,89 +168,21 @@ MP4Decoder::CanHandleMediaType(const nsA
     return false;
   }
   nsString codecs;
   parser.GetParameter("codecs", codecs);
 
   return CanHandleMediaType(NS_ConvertUTF16toUTF8(mimeType), codecs);
 }
 
-static bool
-IsFFmpegAvailable()
-{
-#ifndef MOZ_FFMPEG
-  return false;
-#else
-  PDMFactory::Init();
-  nsRefPtr<PlatformDecoderModule> m = FFmpegRuntimeLinker::CreateDecoderModule();
-  return !!m;
-#endif
-}
-
-static bool
-IsAppleAvailable()
-{
-#ifndef MOZ_APPLEMEDIA
-  // Not the right platform.
-  return false;
-#else
-  return Preferences::GetBool("media.apple.mp4.enabled", false);
-#endif
-}
-
-static bool
-IsAndroidAvailable()
-{
-#ifndef MOZ_WIDGET_ANDROID
-  return false;
-#else
-  // We need android.media.MediaCodec which exists in API level 16 and higher.
-  return AndroidBridge::Bridge() && (AndroidBridge::Bridge()->GetAPIVersion() >= 16);
-#endif
-}
-
-static bool
-IsGonkMP4DecoderAvailable()
-{
-#ifndef MOZ_GONK_MEDIACODEC
-  return false;
-#else
-  return Preferences::GetBool("media.fragmented-mp4.gonk.enabled", false);
-#endif
-}
-
-static bool
-IsGMPDecoderAvailable()
-{
-  return Preferences::GetBool("media.fragmented-mp4.gmp.enabled", false);
-}
-
-static bool
-HavePlatformMPEGDecoders()
-{
-  return Preferences::GetBool("media.fragmented-mp4.use-blank-decoder") ||
-#ifdef XP_WIN
-         // We have H.264/AAC platform decoders on Windows Vista and up.
-         IsVistaOrLater() ||
-#endif
-         IsAndroidAvailable() ||
-         IsFFmpegAvailable() ||
-         IsAppleAvailable() ||
-         IsGonkMP4DecoderAvailable() ||
-         IsGMPDecoderAvailable() ||
-         // TODO: Other platforms...
-         false;
-}
-
 /* static */
 bool
 MP4Decoder::IsEnabled()
 {
-  return Preferences::GetBool("media.fragmented-mp4.enabled") &&
-         HavePlatformMPEGDecoders();
+  return Preferences::GetBool("media.fragmented-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
 };