Commit 514843b2 authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

mediacodec: avoid IllegalStateException on some weird devices

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.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8837684f
...@@ -419,6 +419,15 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, int loo ...@@ -419,6 +419,15 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, int loo
ptr, chroma_div); ptr, chroma_div);
} }
(*env)->CallVoidMethod(env, p_sys->codec, p_sys->release_output_buffer, index, false); (*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); (*env)->DeleteLocalRef(env, buf);
} else if (index == INFO_OUTPUT_BUFFERS_CHANGED) { } else if (index == INFO_OUTPUT_BUFFERS_CHANGED) {
msg_Dbg(p_dec, "output buffers changed"); msg_Dbg(p_dec, "output buffers changed");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment