[vlc-commits] mediacodec: add more safety checks when trying to get codec capabilities
Felix Abecassis
git at videolan.org
Wed Feb 19 16:42:34 CET 2014
vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Wed Feb 19 16:39:19 2014 +0100| [addc5f26d000a390ba3a7b7a2e840620e8d3b88a] | committer: Jean-Baptiste Kempf
mediacodec: add more safety checks when trying to get codec capabilities
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=addc5f26d000a390ba3a7b7a2e840620e8d3b88a
---
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 330997d..8fa68fa 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);
More information about the vlc-commits
mailing list