Bug 1026704 - Prefer FMP4 over GStreamer. r=rillian
authorCorentin Cos <corentin.cos@gmail.com>
Tue, 17 Jun 2014 00:32:18 +0200
changeset 189460 e047743374c453e0e320c2e244a580c72fb4d7db
parent 189459 f7874b813322e6d3ad9720c2a7a014433b908a33
child 189461 8cf3aebcaeeb3a02e80135f749313a3c7df92818
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersrillian
bugs1026704
milestone33.0a1
Bug 1026704 - Prefer FMP4 over GStreamer. r=rillian This change has to be made because FMP4 is meant to take over GStreamer for MP4 file format. This way, FMP4 will be instantiated by default over GStreamer if both tools work (on a certain Linux platform).
content/media/DecoderTraits.cpp
--- a/content/media/DecoderTraits.cpp
+++ b/content/media/DecoderTraits.cpp
@@ -482,16 +482,22 @@ DecoderTraits::CanHandleMediaType(const 
 
 // Instantiates but does not initialize decoder.
 static
 already_AddRefed<MediaDecoder>
 InstantiateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
 {
   nsRefPtr<MediaDecoder> decoder;
 
+#ifdef MOZ_FMP4
+  if (IsMP4SupportedType(aType)) {
+    decoder = new MP4Decoder();
+    return decoder.forget();
+  }
+#endif
 #ifdef MOZ_GSTREAMER
   if (IsGStreamerSupportedType(aType)) {
     decoder = new GStreamerDecoder();
     return decoder.forget();
   }
 #endif
 #ifdef MOZ_RAW
   if (IsRawType(aType)) {
@@ -552,22 +558,16 @@ InstantiateDecoder(const nsACString& aTy
 #ifdef MOZ_DIRECTSHOW
   // Note: DirectShow should come before WMF, so that we prefer DirectShow's
   // MP3 support over WMF's.
   if (IsDirectShowSupportedType(aType)) {
     decoder = new DirectShowDecoder();
     return decoder.forget();
   }
 #endif
-#ifdef MOZ_FMP4
-  if (IsMP4SupportedType(aType)) {
-    decoder = new MP4Decoder();
-    return decoder.forget();
-  }
-#endif
 #ifdef MOZ_WMF
   if (IsWMFSupportedType(aType)) {
     decoder = new WMFDecoder();
     return decoder.forget();
   }
 #endif
 #ifdef MOZ_APPLEMEDIA
   if (IsAppleMediaSupportedType(aType)) {
@@ -592,16 +592,21 @@ DecoderTraits::CreateDecoder(const nsACS
   return decoder.forget();
 }
 
 /* static */
 MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, AbstractMediaDecoder* aDecoder)
 {
   MediaDecoderReader* decoderReader = nullptr;
 
+#ifdef MOZ_FMP4
+  if (IsMP4SupportedType(aType)) {
+    decoderReader = new MP4Reader(aDecoder);
+  } else
+#endif
 #ifdef MOZ_GSTREAMER
   if (IsGStreamerSupportedType(aType)) {
     decoderReader = new GStreamerReader(aDecoder);
   } else
 #endif
 #ifdef MOZ_RAW
   if (IsRawType(aType)) {
     decoderReader = new RawReader(aDecoder);
@@ -633,21 +638,16 @@ MediaDecoderReader* DecoderTraits::Creat
 #endif
 #ifdef MOZ_DIRECTSHOW
   // Note: DirectShowReader is preferred for MP3, but if it's disabled we
   // fallback to the WMFReader.
   if (IsDirectShowSupportedType(aType)) {
     decoderReader = new DirectShowReader(aDecoder);
   } else
 #endif
-#ifdef MOZ_FMP4
-  if (IsMP4SupportedType(aType)) {
-    decoderReader = new MP4Reader(aDecoder);
-  } else
-#endif
 #ifdef MOZ_WMF
   if (IsWMFSupportedType(aType)) {
     decoderReader = new WMFReader(aDecoder);
   } else
 #endif
 #ifdef MOZ_APPLEMEDIA
   if (IsAppleMediaSupportedType(aType)) {
     decoderReader = new AppleMP3Reader(aDecoder);