Bug 1231793: Part 4 - Added checks for Wave type in AndroidDecoderModule. r=jya
authorLouis Christie <lchristie@mozilla.com>
Fri, 12 Feb 2016 14:40:24 +1300
changeset 331293 789acc6a4b930f63daf58a86664924486cda09b4
parent 331292 a01e50ace1a42c087898ba1f96c19178462537ad
child 331294 60d3873f4ad3f9698adeff1dd57aaa389134af9d
push id10956
push userjolesen@mozilla.com
push dateTue, 16 Feb 2016 19:12:12 +0000
reviewersjya
bugs1231793
milestone47.0a1
Bug 1231793: Part 4 - Added checks for Wave type in AndroidDecoderModule. r=jya
dom/media/platforms/android/AndroidDecoderModule.cpp
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -253,16 +253,25 @@ AndroidDecoderModule::SupportsMimeType(c
     return false;
   }
 
   if (aMimeType.EqualsLiteral("video/mp4") ||
       aMimeType.EqualsLiteral("video/avc")) {
     return true;
   }
 
+  // When checking "audio/x-wav", CreateDecoder can cause a JNI ERROR by
+  // Accessing a stale local reference leading to a SIGSEGV crash.
+  // To avoid this we check for wav types here.
+  if (aMimeType.EqualsLiteral("audio/x-wav") ||
+      aMimeType.EqualsLiteral("audio/wave; codecs=1") ||
+      aMimeType.EqualsLiteral("audio/wave; codecs=65534")) {
+    return false;
+  }  
+
   return widget::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
       nsCString(TranslateMimeType(aMimeType)));
 }
 
 already_AddRefed<MediaDataDecoder>
 AndroidDecoderModule::CreateVideoDecoder(
     const VideoInfo& aConfig, layers::LayersBackend aLayersBackend,
     layers::ImageContainer* aImageContainer, FlushableTaskQueue* aVideoTaskQueue,