[vlc-devel] [PATCH 2/2] mediacodec: add more safety checks when trying to get codec capabilities
Felix Abecassis
felix.abecassis at gmail.com
Wed Feb 19 16:39:19 CET 2014
---
modules/codec/omxil/android_mediacodec.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 0796fe0..22f8350 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -310,8 +310,13 @@ static int OpenDecoder(vlc_object_t *p_this)
jobject codec_capabilities = (*env)->CallObjectMethod(env, info, p_sys->get_capabilities_for_type,
(*env)->NewStringUTF(env, mime));
- jobject profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field);
- int profile_levels_len = profile_levels ? (*env)->GetArrayLength(env, profile_levels) : 0;
+ jobject profile_levels = NULL;
+ int profile_levels_len = 0;
+ 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);
+ }
msg_Dbg(p_dec, "Number of profile levels: %d", profile_levels_len);
jobject types = (*env)->CallObjectMethod(env, info, p_sys->get_supported_types);
--
1.8.3.2
More information about the vlc-devel
mailing list