Bug 1266792 - Don't play opus with AndroidDecoderModule. r?jya draft
authorRalph Giles <giles@mozilla.com>
Mon, 31 Oct 2016 16:39:03 -0700
changeset 431911 15b9a6274b27d216fae3b0b75074fd3ad5c6ae51
parent 431910 4b1aa00dfb8c7a55abc95886e65a6968c7d3c92b
child 535506 2f1002f796620ac7567d39b177e6dc61bbec3c9a
push id34153
push userbmo:giles@thaumas.net
push dateMon, 31 Oct 2016 23:49:26 +0000
reviewersjya
bugs1266792
milestone52.0a1
Bug 1266792 - Don't play opus with AndroidDecoderModule. r?jya The android 5.1.1 OMX decoder claims to support audio/opus but crashes on the output of our mp4 demuxer. Work around this by rejecting the mime type, allowing fallback to the libopus-based AgnosticDecoderModule. In any case, since we're shipping the libopus-based decoder we're prefer to use it for consistency. MozReview-Commit-ID: GQaTMALajnZ
dom/media/platforms/android/AndroidDecoderModule.cpp
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -146,16 +146,23 @@ AndroidDecoderModule::SupportsMimeType(c
 
   if ((VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8) &&
        !GetFeatureStatus(nsIGfxInfo::FEATURE_VP8_HW_DECODE)) ||
       (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9) &&
        !GetFeatureStatus(nsIGfxInfo::FEATURE_VP9_HW_DECODE))) {
     return false;
   }
 
+  // Prefer the gecko decoder for opus; stagefright crashes
+  // on content demuxed from mp4.
+  if (aMimeType.EqualsLiteral("audio/opus")) {
+    LOG("Rejecting audio of type %s", aMimeType.Data());
+    return false;
+  }
+
   return java::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
       nsCString(TranslateMimeType(aMimeType)));
 }
 
 already_AddRefed<MediaDataDecoder>
 AndroidDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   MediaFormat::LocalRef format;