[vlc-commits] d3d11_fmt: use a context_mutex for external devices too

Steve Lhomme git at videolan.org
Fri Apr 2 13:55:52 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Mar 30 08:46:28 2021 +0200| [0411ae06a8b259ec6df0e60c5b3df429701d9f50] | committer: Steve Lhomme

d3d11_fmt: use a context_mutex for external devices too

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0411ae06a8b259ec6df0e60c5b3df429701d9f50
---

 modules/video_chroma/d3d11_fmt.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 988cf98fd7..affc031246 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -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;
 



More information about the vlc-commits mailing list