Bug 838331 - Add MP3 to codec list for Firefox OS. r=doublec
authorIan Gilman <ian@iangilman.com>
Thu, 20 Jun 2013 16:49:35 -0400
changeset 147396 3b16a9c6fb6a6940c59cc5ab6afc86db89be1862
parent 147395 de3fdcf79d7972cb9977c1a0df8327b01f95d582
child 147397 e8d3827f914c950dea1ff401353512638317ea27
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec
bugs838331
milestone24.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 838331 - Add MP3 to codec list for Firefox OS. r=doublec
content/media/DecoderTraits.cpp
--- a/content/media/DecoderTraits.cpp
+++ b/content/media/DecoderTraits.cpp
@@ -223,16 +223,21 @@ static char const *const gH264Codecs[9] 
   "avc1.58A01E",  // H.264 Extended Profile Level 3.0
   "avc1.4D401E",  // H.264 Main Profile Level 3.0
   "avc1.64001E",  // H.264 High Profile Level 3.0
   "avc1.64001F",  // H.264 High Profile Level 3.1
   "mp4v.20.3",    // 3GPP
   "mp4a.40.2",    // AAC-LC
   nullptr
 };
+
+static char const *const gMpegAudioCodecs[2] = {
+  "mp3",          // MP3
+  nullptr
+};
 #endif
 
 #ifdef MOZ_MEDIA_PLUGINS
 static bool
 IsMediaPluginsType(const nsACString& aType)
 {
   if (!MediaDecoder::IsMediaPluginsEnabled()) {
     return false;
@@ -331,18 +336,22 @@ DecoderTraits::CanHandleMediaType(const 
                                            aHaveRequestedCodecs ? &aRequestedCodecs : nullptr)) {
     if (aHaveRequestedCodecs)
       return CANPLAY_YES;
     return CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_OMX_DECODER
   if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
-    codecList = gH264Codecs;
     result = CANPLAY_MAYBE;
+    if (nsDependentCString(aMIMEType).EqualsASCII("audio/mpeg")) {
+      codecList = gMpegAudioCodecs;
+    } else {
+      codecList = gH264Codecs;
+    }
   }
 #endif
 #ifdef MOZ_WMF
   if (WMFDecoder::GetSupportedCodecs(nsDependentCString(aMIMEType), &codecList)) {
     result = CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_MEDIA_PLUGINS