Bug 1320705: P8. Don't use stagefright to decode vorbis. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 05 Dec 2016 07:41:54 +1100
changeset 447405 da4bdb7cb2e441bb9eb06e426e3372ffa34c7770
parent 447404 a1e2d03a1a81d22ed77b5cf62645f0b81674be53
child 539024 1a1f1970098c0eec990e335fe9971b80e5ca83eb
push id38050
push userbmo:jyavenard@mozilla.com
push dateSun, 04 Dec 2016 20:45:36 +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)));
 }