[vlc-commits] mediacodec: check exceptions after getCapabilitiesForType()

Felix Abecassis git at videolan.org
Thu Apr 3 15:37:39 CEST 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Thu Apr  3 15:37:13 2014 +0200| [14b85712d1ed59aa37c23f07a85c8c694ff73b09] | committer: Felix Abecassis

mediacodec: check exceptions after getCapabilitiesForType()

Avoid crashing on some devices, but it forces fallback to SW decoding.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=14b85712d1ed59aa37c23f07a85c8c694ff73b09
---

 modules/codec/omxil/android_mediacodec.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 951d879..ba70fdc 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -388,7 +388,11 @@ static int OpenDecoder(vlc_object_t *p_this)
                                                               (*env)->NewStringUTF(env, mime));
         jobject profile_levels = NULL;
         int profile_levels_len = 0;
-        if (codec_capabilities) {
+        if ((*env)->ExceptionOccurred(env)) {
+            msg_Warn(p_dec, "Exception occurred in MediaCodecInfo.getCapabilitiesForType");
+            (*env)->ExceptionClear(env);
+            break;
+        } else if (codec_capabilities) {
             profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field);
             if (profile_levels)
                 profile_levels_len = (*env)->GetArrayLength(env, profile_levels);



More information about the vlc-commits mailing list