[vlc-devel] [PATCH] [RFC] mediacodec: avoid IllegalStateException on some weird devices
Edward Wang
edward.c.wang at compdigitec.com
Fri Jan 18 00:43:05 CET 2013
01-17 18:53:34.959 E/VLC/VlcCrashHandler(16725): java.lang.IllegalStateException
01-17 18:53:34.959 E/VLC/VlcCrashHandler(16725): at android.media.MediaCodec.releaseOutputBuffer(Native Method)
01-17 18:53:34.959 E/VLC/VlcCrashHandler(16725): at dalvik.system.NativeStart.run(Native Method)
Personally I don't notice any performance regression.
---
Suggestions welcome.
modules/codec/omxil/android_mediacodec.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index ee43cd8..246e7d1 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -419,6 +419,15 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, int loo
ptr, chroma_div);
}
(*env)->CallVoidMethod(env, p_sys->codec, p_sys->release_output_buffer, index, false);
+ jthrowable exception = (*env)->ExceptionOccurred(env);
+ if(exception != NULL) {
+ jclass illegalStateException = (*env)->FindClass(env, "java/lang/IllegalStateException");
+ if((*env)->IsInstanceOf(env, exception, illegalStateException)) {
+ msg_Err(p_dec, "Codec error (IllegalStateException) in MediaCodec.releaseOutputBuffer");
+ (*env)->ExceptionClear(env);
+ (*env)->DeleteLocalRef(env, illegalStateException);
+ }
+ }
(*env)->DeleteLocalRef(env, buf);
} else if (index == INFO_OUTPUT_BUFFERS_CHANGED) {
msg_Dbg(p_dec, "output buffers changed");
--
1.7.5.4
More information about the vlc-devel
mailing list