Commit 72b2b969 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

mediacodec: cleanly abort DecodeVideo if GetOutput failed

- Fix possible infinite loop with sw rendering if GetOutput failed.
- Don't return a pic and don't release the block in case of error_state.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit ab4c04f2f5545dcc3cae7ebffe8d28f3e2c5a915)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 18a597c4
...@@ -936,6 +936,8 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) ...@@ -936,6 +936,8 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
if (index < 0) { if (index < 0) {
GetOutput(p_dec, env, &p_pic, timeout); GetOutput(p_dec, env, &p_pic, timeout);
if (p_sys->error_state)
break;
if (p_pic) { if (p_pic) {
/* If we couldn't get an available input buffer but a /* If we couldn't get an available input buffer but a
* decoded frame is available, we return the frame * decoded frame is available, we return the frame
...@@ -998,6 +1000,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) ...@@ -998,6 +1000,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
p_sys->decoded = true; p_sys->decoded = true;
break; break;
} }
if (p_sys->error_state) {
if (p_pic)
decoder_DeletePicture(p_dec, p_pic);
jni_detach_thread();
return NULL;
}
if (!p_pic) if (!p_pic)
GetOutput(p_dec, env, &p_pic, 0); GetOutput(p_dec, env, &p_pic, 0);
(*myVm)->DetachCurrentThread(myVm); (*myVm)->DetachCurrentThread(myVm);
......
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