[vlc-commits] mediacodec: check if codec is blacklisted first

Thomas Guillem git at videolan.org
Thu Apr 9 10:56:11 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr  9 10:52:00 2015 +0200| [2ac314626f2afca4cdb302fb223fe4291366e0df] | committer: Thomas Guillem

mediacodec: check if codec is blacklisted first

Because getCapabilitiesForType can crash.

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

 modules/codec/omxil/android_mediacodec.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 94c0113..73e0b4f 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -455,6 +455,14 @@ static int OpenDecoder(vlc_object_t *p_this)
 
         info = (*env)->CallStaticObjectMethod(env, jfields.media_codec_list_class,
                                               jfields.get_codec_info_at, i);
+
+        name = (*env)->CallObjectMethod(env, info, jfields.get_name);
+        name_len = (*env)->GetStringUTFLength(env, name);
+        name_ptr = (*env)->GetStringUTFChars(env, name, NULL);
+
+        if (OMXCodec_IsBlacklisted( name_ptr, name_len))
+            goto loopclean;
+
         if ((*env)->CallBooleanMethod(env, info, jfields.is_encoder))
             goto loopclean;
 
@@ -472,13 +480,8 @@ static int OpenDecoder(vlc_object_t *p_this)
 
         types = (*env)->CallObjectMethod(env, info, jfields.get_supported_types);
         num_types = (*env)->GetArrayLength(env, types);
-        name = (*env)->CallObjectMethod(env, info, jfields.get_name);
-        name_len = (*env)->GetStringUTFLength(env, name);
-        name_ptr = (*env)->GetStringUTFChars(env, name, NULL);
         found = false;
 
-        if (OMXCodec_IsBlacklisted( name_ptr, name_len))
-            goto loopclean;
         for (int j = 0; j < num_types && !found; j++) {
             jobject type = (*env)->GetObjectArrayElement(env, types, j);
             if (!jstrcmp(env, type, mime)) {



More information about the vlc-commits mailing list