[vlc-devel] [PATCH] mediacodec: try to return an output frame if we failed to get an available input buffer.

Martin Storsjö martin at martin.st
Mon Nov 4 21:10:36 CET 2013


On Mon, 4 Nov 2013, Felix Abecassis wrote:

> ---
> modules/codec/omxil/android_mediacodec.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
> index d8cf09f..f9ad889 100644
> --- a/modules/codec/omxil/android_mediacodec.c
> +++ b/modules/codec/omxil/android_mediacodec.c
> @@ -528,7 +528,16 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
>     while (true) {
>         int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout);
>         if (index < 0) {
> -            GetOutput(p_dec, env, &p_pic, timeout > 0);
> +            GetOutput(p_dec, env, &p_pic, 0);
> +            if (p_pic) {
> +                /* If we couldn't get an available input buffer but a
> +                 * decoded frame is available, we return the frame
> +                 * without assigning NULL to *pp_block. The next call
> +                 * to DecodeVideo will try to send the input packet again.
> +                 */
> +                (*myVm)->DetachCurrentThread(myVm);
> +                return p_pic;
> +            }
>             timeout = 30;
>             continue;
>         }
> -- 
> 1.8.3.2

Ok with me, applied.

I'll push a simplification of GetOutput as well, now that we always use it 
in the same fashion.

// Martin



More information about the vlc-devel mailing list