Skip to content

Commit

Permalink
d3d11_fmt: use a context_mutex for external devices too
Browse files Browse the repository at this point in the history
If the owner doesn't set the GUID_CONTEXT_MUTEX we should still have a mutex
when we want to use the device with a hardware decoder.

The owner of the ID3D11DeviceContext doesn't need to set the mutex if it
doesn't use the ID3D11DeviceContext outside of the callbacks called by libvlc.
  • Loading branch information
robUx4 committed Apr 2, 2021
1 parent f3b16b6 commit 0411ae0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/video_chroma/d3d11_fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ static HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext
hr = ID3D11DeviceContext_GetPrivateData(d3d11ctx, &GUID_CONTEXT_MUTEX, &dataSize, &context_lock);
if (SUCCEEDED(hr))
out->context_mutex = context_lock;
else if (hw_decoding)
{
out->mutex_owner = true;
out->context_mutex = CreateMutexEx( NULL, NULL, 0, SYNCHRONIZE );
ID3D11DeviceContext_SetPrivateData( out->d3dcontext, &GUID_CONTEXT_MUTEX,
sizeof( out->context_mutex ), &out->context_mutex );
}
else
out->context_mutex = INVALID_HANDLE_VALUE;

Expand Down

0 comments on commit 0411ae0

Please sign in to comment.