Bug 986381 - Add webm into omx codec supported list and modify CanHandleMediaType r=cpearce
authorBlake Wu <bwu@mozilla.com>
Wed, 07 May 2014 18:05:29 +0800
changeset 182125 49831d474b17
parent 182124 6d8b0bf673c5
child 182126 a2a9fef81547
push id26748
push userryanvm@gmail.com
push dateThu, 08 May 2014 19:44:34 +0000
treeherdermozilla-central@4cafec48a1f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs986381
milestone32.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 986381 - Add webm into omx codec supported list and modify CanHandleMediaType r=cpearce
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_DIRECTSHOW
   // Note: DirectShow should come before WMF, so that we prefer DirectShow's
   // MP3 support over WMF's.