Bug 1330284 - Use MediaContentType in DecoderTraits:IsAndroidMediaType() - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 22 Dec 2016 12:43:19 +1100
changeset 374476 7456fe7977717aabce8a901164e73b8cf4fa3765
parent 374475 3271745425d782a0f643410f3d14efa46586d10c
child 374477 e0c2f4a53ca10552a609d776a9faecb94b8fa376
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1330284
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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