Bug 986381 - Add webm into omx codec supported list and modify CanHandleMediaType. r=cpearce, a=1.4+
authorBlake Wu <bwu@mozilla.com>
Wed, 07 May 2014 18:05:29 +0800
changeset 187414 b7f5d141c237
parent 187413 34b821bbc7ba
child 187415 3ecdbb73c057
push id71
push userryanvm@gmail.com
push dateThu, 08 May 2014 20:43:47 +0000
treeherdermozilla-b2g30_v1_4@e96076a30b09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, 1
bugs986381
milestone30.0
Bug 986381 - Add webm into omx codec supported list and modify CanHandleMediaType. r=cpearce, a=1.4+
content/media/DecoderTraits.cpp
--- a/content/media/DecoderTraits.cpp
+++ b/content/media/DecoderTraits.cpp
@@ -202,23 +202,27 @@ IsGStreamerSupportedType(const nsACStrin
   if (IsOggType(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false))
     return false;
 
   return GStreamerDecoder::CanHandleMediaType(aMimeType, nullptr);
 }
 #endif
 
 #ifdef MOZ_OMX_DECODER
-static const char* const gOmxTypes[7] = {
+static const char* const gOmxTypes[] = {
   "audio/mpeg",
   "audio/mp4",
   "audio/amr",
   "video/mp4",
   "video/3gpp",
   "video/quicktime",
+#ifdef MOZ_OMX_WEBM_DECODER
+  "video/webm",
+  "audio/webm",
+#endif
   nullptr
 };
 
 static bool
 IsOmxSupportedType(const nsACString& aType)
 {
   if (!MediaDecoder::IsOmxEnabled()) {
     return false;
@@ -238,16 +242,26 @@ static char const *const gH264Codecs[9] 
   "mp4a.40.2",    // AAC-LC
   nullptr
 };
 
 static char const *const gMpegAudioCodecs[2] = {
   "mp3",          // MP3
   nullptr
 };
+
+#ifdef MOZ_OMX_WEBM_DECODER
+static char const *const gOMXWebMCodecs[4] = {
+  "vorbis",
+  "vp8",
+  "vp8.0",
+  nullptr
+};
+#endif //MOZ_OMX_WEBM_DECODER
+
 #endif
 
 #ifdef NECKO_PROTOCOL_rtsp
 static const char* const gRtspTypes[2] = {
     "RTSP",
     nullptr
 };
 
@@ -375,17 +389,17 @@ DecoderTraits::CanHandleMediaType(const 
     result = CANPLAY_MAYBE;
   }
 #ifdef MOZ_WAVE
   if (IsWaveType(nsDependentCString(aMIMEType))) {
     codecList = gWaveCodecs;
     result = CANPLAY_MAYBE;
   }
 #endif
-#ifdef MOZ_WEBM
+#if defined(MOZ_WEBM) && !defined(MOZ_OMX_WEBM_DECODER)
   if (IsWebMType(nsDependentCString(aMIMEType))) {
     codecList = gWebMCodecs;
     result = CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_GSTREAMER
   if (GStreamerDecoder::CanHandleMediaType(nsDependentCString(aMIMEType),
                                            aHaveRequestedCodecs ? &aRequestedCodecs : nullptr)) {
@@ -394,16 +408,21 @@ DecoderTraits::CanHandleMediaType(const 
     return CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_OMX_DECODER
   if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
     result = CANPLAY_MAYBE;
     if (nsDependentCString(aMIMEType).EqualsASCII("audio/mpeg")) {
       codecList = gMpegAudioCodecs;
+#ifdef MOZ_OMX_WEBM_DECODER
+    } else if (nsDependentCString(aMIMEType).EqualsASCII("audio/webm") ||
+               nsDependentCString(aMIMEType).EqualsASCII("video/webm")) {
+      codecList = gOMXWebMCodecs;
+#endif
     } else {
       codecList = gH264Codecs;
     }
   }
 #endif
 #ifdef MOZ_WMF
   if (IsWMFSupportedType(nsDependentCString(aMIMEType))) {
     if (!aHaveRequestedCodecs) {