[vlc-devel] [PATCH] avcodec VA: try to reuse the current video acceleration

Steve Lhomme robux4 at videolabs.io
Tue Apr 7 11:59:13 CEST 2015


On Tue, Apr 7, 2015 at 10:11 AM, Steve Lhomme <robUx4 at videolabs.io> wrote:
> --
> when seeking we may reset the whole decoder and get new buffers, but avcodec doesn't seem to know old buffers changed and still use the released ones as reference
>
> this is a workaround, a cleaner fix may be to ensure avcodec doesn't reuse buffers we released after a ffmpeg_GetFormat()
> ---
>  modules/codec/avcodec/video.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index c4488c0..b40dd69 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -1358,7 +1358,28 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
>      vlc_va_t *p_va = p_sys->p_va;
>
>      if( p_va != NULL )
> +    {
> +        for( size_t i = 0; pi_fmt[i] != PIX_FMT_NONE; i++ )
> +        {
> +            if( p_va->pix_fmt != pi_fmt[i] )
> +                continue;
> +
> +            if( p_context->width <= 0 || p_context->height <= 0
> +             || !vlc_va_Setup( p_va, p_context, &p_dec->fmt_out.video.i_chroma ) )

Incorrect logic on the return value. New patch incoming.

> +            {
> +                msg_Err( p_dec, "reusing acceleration failed" );
> +                break;
> +            }
> +
> +            if( p_va->description )
> +                msg_Info( p_dec, "Reusing %s for hardware decoding.",
> +                          p_va->description );
> +
> +            return pi_fmt[i];
> +        }
> +
>          vlc_va_Delete( p_va, p_context );
> +    }
>
>      /* Enumerate available formats */
>      bool can_hwaccel = false;
> --
> 2.3.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list