Bug 1330284 - Use MediaContentType in DecoderTraits:IsAndroidMediaType() - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 22 Dec 2016 12:43:19 +1100
changeset 460042 f4819fa9c01f6cdb870e868511b201b8af0621c0
parent 460041 ed188eb7d4c55825f4e7c8abaa43b651531f7124
child 460043 8de4988b0fe4adadcf73680819175768883d3d81
push id41348
push usergsquelart@mozilla.com
push dateThu, 12 Jan 2017 20:50:49 +0000
reviewersjya
bugs1330284
milestone53.0a1
Bug 1330284 - Use MediaContentType in DecoderTraits:IsAndroidMediaType() - r?jya MozReview-Commit-ID: 6gK5FqMDypq
dom/media/DecoderTraits.cpp
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -75,26 +75,26 @@ static char const *const gHttpLiveStream
 static bool
 IsHttpLiveStreamingType(const nsACString& aType)
 {
   return CodecListContains(gHttpLiveStreamingTypes, aType);
 }
 
 #ifdef MOZ_ANDROID_OMX
 static bool
-IsAndroidMediaType(const nsACString& aType)
+IsAndroidMediaType(const MediaContentType& aType)
 {
   if (!MediaDecoder::IsAndroidMediaPluginEnabled()) {
     return false;
   }
 
-  static const char* supportedTypes[] = {
-    "audio/mpeg", "audio/mp4", "video/mp4", "video/x-m4v", nullptr
-  };
-  return CodecListContains(supportedTypes, aType);
+  return aType.Type() == MEDIAMIMETYPE("audio/mpeg")
+         || aType.Type() == MEDIAMIMETYPE("audio/mp4")
+         || aType.Type() == MEDIAMIMETYPE("video/mp4")
+         || aType.Type() == MEDIAMIMETYPE("video/x-m4v");
 }
 #endif
 
 /* static */ bool
 DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
                                   DecoderDoctorDiagnostics* aDiagnostics)
 {
 #ifdef MOZ_FMP4
@@ -450,17 +450,17 @@ bool DecoderTraits::IsSupportedInVideoDo
   if (!type) {
     return false;
   }
 
   return
     OggDecoder::IsSupportedType(*type) ||
     WebMDecoder::IsSupportedType(*type) ||
 #ifdef MOZ_ANDROID_OMX
-    (MediaDecoder::IsAndroidMediaPluginEnabled() && IsAndroidMediaType(aType)) ||
+    (MediaDecoder::IsAndroidMediaPluginEnabled() && IsAndroidMediaType(*type)) ||
 #endif
 #ifdef MOZ_FMP4
     MP4Decoder::IsSupportedType(*type, /* DecoderDoctorDiagnostics* */ nullptr) ||
 #endif
     MP3Decoder::IsSupportedType(*type) ||
     ADTSDecoder::IsSupportedType(*type) ||
     FlacDecoder::IsSupportedType(*type) ||
 #ifdef MOZ_DIRECTSHOW