[vlc-devel] [PATCH] DXVA2: lock the buffer pool when getting/releasing a buffer (v4)

Steve Lhomme robux4 at videolabs.io
Thu Apr 23 08:13:03 CEST 2015

On Wed, Apr 22, 2015 at 7:32 PM, Steve Lhomme <robux4 at videolabs.io> wrote:
> On Wed, Apr 22, 2015 at 7:23 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
>> Le mercredi 22 avril 2015, 16:15:49 Steve Lhomme a écrit :
>>> You can look at vaapi.c which uses similar "asymmetrical" calls. The
>>> only difference is that he lock is always there, even if only 1 thread
>>> will be used.
>> Sigh. In principles, b_thread_safe_callbacks means that get_buffer2 (so Get())
>> is thread-safe. Release() should always be thread-safe.
>> In practice, b_thread_safe_callbacks is always true because HAVE_AVCODEC_MT is
>> always defined, because FF_THREAD_FRAME is always defined.
>> So the if-statement is useless and confusing at best.
> OK, now I understand what you meant by "How so?
> !avctx->thread_safe_callbacks only affects avctx->get_buffer2, so
> va->get. I don't see how it helps va->release."
> At some point I submited a patch where thread_safe_callbacks was set
> to false on windows, rather than disabling frame multithreading in
> avcodec. And it worked better. That's why I added the test so that the
> lock is only used when actually necessary.
> I don't think setting thread_safe_callbacks to false will be on the
> table again, so I will submit a new patch where the lock is always
> used, like in vaapi.c

New v5 patch submited without the unneeded if

More information about the vlc-devel mailing list