Bug 1408445 - handle exception when querying codec capabilities. r=esawin
authorJohn Lin <jolin@mozilla.com>
Sun, 15 Oct 2017 14:54:46 +0800
changeset 386496 1dfddc19749e36b8cca7af133fe34498e57118bc
parent 386495 04b28fc1254775fa4cbcc49a264fb86283bbb306
child 386497 615798b405f4994de32c6a9b0a464601accb0b0e
push id32694
push userarchaeopteryx@coole-files.de
push dateTue, 17 Oct 2017 09:43:13 +0000
treeherdermozilla-central@3bd3448d9684 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1408445
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1408445 - handle exception when querying codec capabilities. r=esawin MozReview-Commit-ID: 5Ee3eQqAgvG
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
@@ -306,20 +306,24 @@ final class JellyBeanAsyncCodec implemen
 
     @Override
     public boolean isAdaptivePlaybackSupported(String mimeType) {
         return HardwareCodecCapabilityUtils.checkSupportsAdaptivePlayback(mCodec, mimeType);
     }
 
     @Override
     public boolean isTunneledPlaybackSupported(final String mimeType) {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP
-               && mCodec.getCodecInfo()
-                        .getCapabilitiesForType(mimeType)
-                        .isFeatureSupported(CodecCapabilities.FEATURE_TunneledPlayback);
+        try {
+            return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP
+                   && mCodec.getCodecInfo()
+                            .getCapabilitiesForType(mimeType)
+                            .isFeatureSupported(CodecCapabilities.FEATURE_TunneledPlayback);
+        } catch (Exception e) {
+            return false;
+        }
     }
 
     private void assertCallbacks() {
         if (mCallbackSender == null) {
             throw new IllegalStateException(LOGTAG + ": callback must be supplied with setCallbacks().");
         }
     }
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
@@ -149,19 +149,23 @@ import java.nio.ByteBuffer;
 
     @Override
     public boolean isAdaptivePlaybackSupported(final String mimeType) {
         return HardwareCodecCapabilityUtils.checkSupportsAdaptivePlayback(mCodec, mimeType);
     }
 
     @Override
     public boolean isTunneledPlaybackSupported(final String mimeType) {
-        return mCodec.getCodecInfo()
-                     .getCapabilitiesForType(mimeType)
-                     .isFeatureSupported(CodecCapabilities.FEATURE_TunneledPlayback);
+        try {
+            return mCodec.getCodecInfo()
+                         .getCapabilitiesForType(mimeType)
+                         .isFeatureSupported(CodecCapabilities.FEATURE_TunneledPlayback);
+        } catch (Exception e) {
+            return false;
+        }
     }
 
     @Override
     public void start() {
         mCodec.start();
     }
 
     @Override