[vlc-devel] [PATCH] avcodec: disable frame multithreading with dxva2

Rémi Denis-Courmont remi at remlab.net
Fri Aug 22 22:50:29 CEST 2014


Le vendredi 22 août 2014, 19:39:50 Felix Abecassis a écrit :
> Fix #11930, #11693
> ---
>  modules/codec/avcodec/video.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index d1fa89b..aacd2f9 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -347,6 +347,20 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext
> *p_context, # endif
>      }
> 
> +    /* Workaround: frame multithreading is not compatible with
> +     * DXVA2. When a frame is being copied to host memory, the frame
> +     * is locked and cannot be used as a reference frame
> +     * simultaneously and thus decoding fails for some frames. This
> +     * causes major image corruption. */
> +# if defined(_WIN32)
> +    const char *avcodec_hw = var_InheritString( p_dec, "avcodec-hw" );
> +    if( avcodec_hw == NULL || !strcmp( avcodec_hw, "dxva2" ) )

So, hmm, what happens if it's "dxva2,any", "foobar,dxva2,none" or 
"superduperdxva2" ?

Also, leaks.

> +    {
> +        msg_Warn( p_dec, "threaded frame decoding is not compatible with
> DXVA2, disabled" ); +        p_sys->p_context->thread_type &=
> ~FF_THREAD_FRAME;
> +    }
> +# endif
> +
>      if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
>          p_dec->i_extra_picture_buffers = 2 *
> p_sys->p_context->thread_count; #endif

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list