Bug 1320705: P8. Don't use stagefright to decode vorbis. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 05 Dec 2016 07:41:54 +1100
changeset 325262 52cc3c8b17c96e2a008fedaec7149427d1b31530
parent 325261 328475b7579ca8ef7b019703b9a10dfbc8a802dd
child 325269 bd9e81439725f3d4135652cc3d65f2bfba527b7b
child 325272 d9658fd731f0d149c634df832855a89dc872d127
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersgerald
bugs1320705
milestone53.0a1
Bug 1320705: P8. Don't use stagefright to decode vorbis. r=gerald Fixing the codec mimetype in P6, had the side effect of Android PDM trying to use the stagefright decoder which crashes. MozReview-Commit-ID: 1OSGGCTdGFO
dom/media/platforms/android/AndroidDecoderModule.cpp
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -7,16 +7,19 @@
 
 #include "MediaCodecDataDecoder.h"
 #include "RemoteDataDecoder.h"
 
 #include "MediaInfo.h"
 #include "VPXDecoder.h"
 
 #include "MediaPrefs.h"
+#include "OpusDecoder.h"
+#include "VorbisDecoder.h"
+
 #include "nsPromiseFlatString.h"
 #include "nsIGfxInfo.h"
 
 #include "prlog.h"
 
 #include <jni.h>
 
 #undef LOG
@@ -151,19 +154,20 @@ 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
+  // Prefer the gecko decoder for opus and vorbis; stagefright crashes
   // on content demuxed from mp4.
-  if (aMimeType.EqualsLiteral("audio/opus")) {
+  if (OpusDataDecoder::IsOpus(aMimeType) ||
+      VorbisDataDecoder::IsVorbis(aMimeType)) {
     LOG("Rejecting audio of type %s", aMimeType.Data());
     return false;
   }
 
   return java::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
       nsCString(TranslateMimeType(aMimeType)));
 }