Bug 795623 - Add audio/mpeg to list of supported OMX codecs. r=doublec, a=blocking-basecamp
authorEdwin Flores <eflores@mozilla.com>
Tue, 09 Oct 2012 17:06:34 +1300
changeset 113337 0e355208adffa4c255a2dd3c2a7251a8960434af
parent 113336 adfd438b56ffd83ce7af0c1eff560ee495b4cdd2
child 113338 690a3827c4658ce4f119567621bee6bd78464323
push id2292
push userryanvm@gmail.com
push dateSat, 13 Oct 2012 19:19:53 +0000
treeherdermozilla-aurora@c0b49817915d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec, blocking-basecamp
bugs795623
milestone18.0a2
Bug 795623 - Add audio/mpeg to list of supported OMX codecs. r=doublec, a=blocking-basecamp
content/html/content/public/nsHTMLMediaElement.h
content/html/content/src/nsHTMLMediaElement.cpp
--- a/content/html/content/public/nsHTMLMediaElement.h
+++ b/content/html/content/public/nsHTMLMediaElement.h
@@ -311,18 +311,18 @@ public:
   static bool IsH264Enabled();
   static bool IsH264Type(const nsACString& aType);
   static const char gH264Types[3][16];
   static char const *const gH264Codecs[7];
 #endif
 
 #ifdef MOZ_WIDGET_GONK
   static bool IsOmxEnabled();
-  static bool IsH264Type(const nsACString& aType);
-  static const char gH264Types[3][16];
+  static bool IsOmxSupportedType(const nsACString& aType);
+  static const char gOmxTypes[5][16];
   static char const *const gH264Codecs[7];
 #endif
 
 #ifdef MOZ_MEDIA_PLUGINS
   static bool IsMediaPluginsEnabled();
   static bool IsMediaPluginsType(const nsACString& aType);
 #endif
 
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -2129,34 +2129,34 @@ nsHTMLMediaElement::IsWebMType(const nsA
     }
   }
 
   return false;
 }
 #endif
 
 #if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
-const char nsHTMLMediaElement::gH264Types[3][16] = {
-  "video/mp4",
-  "video/3gpp",
-  "video/quicktime",
-};
-
 char const *const nsHTMLMediaElement::gH264Codecs[7] = {
   "avc1.42E01E",
   "avc1.42001E",
   "avc1.58A01E",
   "avc1.4D401E",
   "avc1.64001E",
   "mp4a.40.2",
   nullptr
 };
 #endif
 
 #ifdef MOZ_GSTREAMER
+const char nsHTMLMediaElement::gH264Types[3][16] = {
+  "video/mp4",
+  "video/3gpp",
+  "video/quicktime",
+};
+
 bool
 nsHTMLMediaElement::IsH264Enabled()
 {
   return Preferences::GetBool("media.h264.enabled");
 }
 
 bool
 nsHTMLMediaElement::IsH264Type(const nsACString& aType)
@@ -2171,31 +2171,39 @@ nsHTMLMediaElement::IsH264Type(const nsA
     }
   }
 
   return false;
 }
 #endif
 
 #ifdef MOZ_WIDGET_GONK
+const char nsHTMLMediaElement::gOmxTypes[5][16] = {
+  "audio/mpeg",
+  "audio/mp4",
+  "video/mp4",
+  "video/3gpp",
+  "video/quicktime",
+};
+
 bool
 nsHTMLMediaElement::IsOmxEnabled()
 {
   return Preferences::GetBool("media.omx.enabled", false);
 }
 
 bool
-nsHTMLMediaElement::IsH264Type(const nsACString& aType)
+nsHTMLMediaElement::IsOmxSupportedType(const nsACString& aType)
 {
   if (!IsOmxEnabled()) {
     return false;
   }
 
-  for (uint32_t i = 0; i < ArrayLength(gH264Types); ++i) {
-    if (aType.EqualsASCII(gH264Types[i])) {
+  for (uint32_t i = 0; i < ArrayLength(gOmxTypes); ++i) {
+    if (aType.EqualsASCII(gOmxTypes[i])) {
       return true;
     }
   }
 
   return false;
 }
 #endif
 
@@ -2295,17 +2303,17 @@ nsHTMLMediaElement::CanHandleMediaType(c
 
 #ifdef MOZ_GSTREAMER
   if (IsH264Type(nsDependentCString(aMIMEType))) {
     *aCodecList = gH264Codecs;
     return CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_WIDGET_GONK
-  if (IsH264Type(nsDependentCString(aMIMEType))) {
+  if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
     *aCodecList = gH264Codecs;
     return CANPLAY_MAYBE;
   }
 #endif
 #ifdef MOZ_MEDIA_PLUGINS
   if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), aCodecList))
     return CANPLAY_MAYBE;
 #endif
@@ -2327,17 +2335,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
   if (IsWebMType(nsDependentCString(aMIMEType)))
     return true;
 #endif
 #ifdef MOZ_GSTREAMER
   if (IsH264Type(nsDependentCString(aMIMEType)))
     return true;
 #endif
 #ifdef MOZ_WIDGET_GONK
-  if (IsH264Type(nsDependentCString(aMIMEType))) {
+  if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
     return true;
   }
 #endif
 #ifdef MOZ_MEDIA_PLUGINS
   if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), NULL))
     return true;
 #endif
   // We should not return true for Wave types, since there are some
@@ -2448,17 +2456,17 @@ nsHTMLMediaElement::CreateDecoder(const 
   if (IsWaveType(aType)) {
     nsRefPtr<nsWaveDecoder> decoder = new nsWaveDecoder();
     if (decoder->Init(this)) {
       return decoder.forget();
     }
   }
 #endif
 #ifdef MOZ_WIDGET_GONK
-  if (IsH264Type(aType)) {
+  if (IsOmxSupportedType(aType)) {
     nsRefPtr<nsMediaOmxDecoder> decoder = new nsMediaOmxDecoder();
     if (decoder->Init(this)) {
       return decoder.forget();
     }
   }
 #endif
 #ifdef MOZ_MEDIA_PLUGINS
   if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(aType, NULL)) {