[vlc-devel] [PATCH] avcodec: only disable frame threading if DXVA2 is likely to be used
Steve Lhomme
robux4 at videolabs.io
Wed Apr 1 14:11:20 CEST 2015
On Wed, Apr 1, 2015 at 1:27 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2015-03-31 13:16, Steve Lhomme a écrit :
>>
>> Fixes #14054
>
>
> This will leave threading enabled if the video track starts with an
> hardware-unsupported profile, then downgrades to a hardware-supported
> profile (e.g. due to new H.264 SPS). If DxVA2 is compatible with threading,
> then you should remove the whole ifdef. If DxVA2 is not compatible with
> threading, then the patch is wrong.
The file of this issue that introduced the change is working for me in
frame threading.
https://trac.videolan.org/vlc/ticket/11930
It didn't originally work on a Surface Pro 1 but it could be worth if
it's working without the change, now that the code has been
cleaned/optimized a little.
poke j-b or Thomas Nigro.
>> ---
>> modules/codec/avcodec/video.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
>> index 381fe62..379bc62 100644
>> --- a/modules/codec/avcodec/video.c
>> +++ b/modules/codec/avcodec/video.c
>> @@ -396,19 +396,18 @@ int InitVideoDec( decoder_t *p_dec,
>> AVCodecContext *p_context,
>> break;
>> }
>>
>> +# if defined(_WIN32)
>> /* 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)
>> - char *avcodec_hw = var_InheritString( p_dec, "avcodec-hw" );
>> - if( avcodec_hw == NULL || strcasecmp( avcodec_hw, "none" ) )
>> + enum PixelFormat test_formats[] = { AV_PIX_FMT_DXVA2_VLD,
>> AV_PIX_FMT_NONE };
>> + if( AV_PIX_FMT_DXVA2_VLD == ffmpeg_GetFormat( p_context,
>> &test_formats ) )
>> {
>> msg_Warn( p_dec, "threaded frame decoding is not compatible
>> with DXVA2, disabled" );
>> p_context->thread_type &= ~FF_THREAD_FRAME;
>> }
>> - free( avcodec_hw );
>> # endif
>>
>> if( p_context->thread_type & FF_THREAD_FRAME )
>
>
> --
> Rémi Denis-Courmont
>
> _______________________________________________
> 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