[libav-devel] [PATCH] d3d11va: WindowsPhone requires a mutex around ID3D11VideoContext

Steve Lhomme robux4 at videolabs.io
Thu Aug 6 07:43:00 CEST 2015


On Tue, Jul 21, 2015 at 9:44 AM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Tue, Jul 21, 2015 at 9:42 AM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>> On Tue, Jul 21, 2015 at 9:31 AM, Steve Lhomme <robux4 at videolabs.io> wrote:
>>> On Tue, Jul 21, 2015 at 9:13 AM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>>>> On Tue, Jul 21, 2015 at 8:43 AM, Steve Lhomme <robux4 at gmail.com> wrote:
>>>>> In case the VideoContext is used by different threads internally or
>>>>> other threads externally
>>>>> ---
>>>>>  libavcodec/d3d11va.h |  5 +++++
>>>>>  libavcodec/dxva2.c   | 15 +++++++++++++--
>>>>>  libavcodec/version.h |  4 ++--
>>>>>  3 files changed, 20 insertions(+), 4 deletions(-)
>>>>>
>>>>> diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
>>>>> index 2163b35..05d4fa6 100644
>>>>> --- a/libavcodec/d3d11va.h
>>>>> +++ b/libavcodec/d3d11va.h
>>>>> @@ -89,6 +89,11 @@ struct AVD3D11VAContext {
>>>>>       * Private to the Libav AVHWAccel implementation
>>>>>       */
>>>>>      unsigned report_id;
>>>>> +
>>>>> +    /**
>>>>> +      * Mutex to access video_context
>>>>> +      */
>>>>> +    HANDLE  context_mutex;
>>>>>  };
>>>>>
>>>>
>>>> Without an allocation function to alloc this struct and init the
>>>> handle properly (since its init value is not 0, but
>>>> INVALID_HANDLE_VALUE), this seems like it might very easily run into
>>>> issues.
>>>
>>> In the case of VLC, the allocation function would be inconvenient as
>>> we don't allocate all the pieces in the same place. Or do you mean a
>>> function to provide all the elements at once ? In this case it would
>>> be subject to ABI changes (just like to patch).
>>>
>>
>> I just find a value in a context which the user needs to init even if
>> he doesn't use it very disturbing.
>>
>
> And what I meant with an allocation function - a function inside
> avcodec which allocates AVD3D11VAContext for you (which would also
> allow future API additions without ABI breakage), which would then
> init the mutex to its proper inert value, without the user needing to
> do that.
> VDPAU has something like this, for example.

OK, but this should be another patch. It has nothing to do with the
fact that this mutex and the calls are needed to work properly.

In the context of VLC this function would add extra constraints on
where/when we initialize and release the AVD3D11VAContext, so I would
probably not use it anyway.

> - Hendrik
> _______________________________________________
> libav-devel mailing list
> libav-devel at libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel


More information about the libav-devel mailing list