[vlc-devel] [PATCH] mediacodec: cleanly abort DecodeVideo if GetOutput failed

Martin Storsjö martin at martin.st
Thu Oct 23 13:01:00 CEST 2014


On Thu, 23 Oct 2014, Thomas Guillem wrote:

> - 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.
> ---
> modules/codec/omxil/android_mediacodec.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
> index a5e7025..ea7fa39 100644
> --- a/modules/codec/omxil/android_mediacodec.c
> +++ b/modules/codec/omxil/android_mediacodec.c
> @@ -953,6 +953,8 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
>
>         if (index < 0) {
>             GetOutput(p_dec, env, &p_pic, timeout);
> +            if (p_sys->error_state)
> +                break;
>             if (p_pic) {
>                 /* If we couldn't get an available input buffer but a
>                  * decoded frame is available, we return the frame
> @@ -1003,6 +1005,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
>         p_sys->decoded = true;
>         break;
>     }
> +    if (p_sys->error_state) {
> +        if (p_pic)
> +            decoder_DeletePicture(p_dec, p_pic);
> +        jni_detach_thread();
> +        return NULL;
> +    }
>     if (!p_pic)
>         GetOutput(p_dec, env, &p_pic, 0);
>     jni_detach_thread();
> -- 
> 2.1.0

Ok

// Martin



More information about the vlc-devel mailing list