[vlc-devel] [PATCH] mediacodec: Check for exceptions after MediaCodec.start()

Martin Storsjö martin at martin.st
Sun Oct 14 23:46:57 CEST 2012


Also log a warning if MediaCodec.configure() threw an exception.

This fixes issues when playing back H264 over RTSP on devices
supporting MediaCodec - this makes it fall back cleanly to other
decoders. (The actual issue with playing back these streams is
not investigated yet.)
---
 modules/codec/omxil/android_mediacodec.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index fa632f2..cbe3c5c 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -334,10 +334,16 @@ static int OpenDecoder(vlc_object_t *p_this)
 
     (*env)->CallVoidMethod(env, p_sys->codec, p_sys->configure, format, NULL, NULL, 0);
     if ((*env)->ExceptionOccurred(env)) {
+        msg_Warn(p_dec, "Exception occurred in MediaCodec.configure");
         (*env)->ExceptionClear(env);
         goto error;
     }
     (*env)->CallVoidMethod(env, p_sys->codec, p_sys->start);
+    if ((*env)->ExceptionOccurred(env)) {
+        msg_Warn(p_dec, "Exception occurred in MediaCodec.start");
+        (*env)->ExceptionClear(env);
+        goto error;
+    }
     p_sys->started = 1;
 
     p_sys->input_buffers = (*env)->CallObjectMethod(env, p_sys->codec, p_sys->get_input_buffers);
-- 
1.7.10




More information about the vlc-devel mailing list