[vlc-devel] [PATCH 4/8] d3d11_deinterlace: lock the D3D context earlier

Steve Lhomme robux4 at videolabs.io
Sat Jul 1 18:07:10 CEST 2017


---
 modules/video_output/win32/d3d11_deinterlace.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/d3d11_deinterlace.c b/modules/video_output/win32/d3d11_deinterlace.c
index b1006e66bf..fe478265fd 100644
--- a/modules/video_output/win32/d3d11_deinterlace.c
+++ b/modules/video_output/win32/d3d11_deinterlace.c
@@ -124,16 +124,21 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
     D3D11_VIDEO_FRAME_FORMAT frameFormat = src->b_top_field_first ?
                 D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST :
                 D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST;
+
+    if( sys->context_mutex != INVALID_HANDLE_VALUE )
+        WaitForSingleObjectEx( sys->context_mutex, INFINITE, FALSE );
+
     ID3D11VideoContext_VideoProcessorSetStreamFrameFormat(sys->d3dvidctx, sys->videoProcessor, 0, frameFormat);
 
     hr = ID3D11VideoContext_VideoProcessorBlt(sys->d3dvidctx, sys->videoProcessor,
                                               sys->processorOutput,
                                               0, 1, &stream);
     if (FAILED(hr))
+    {
+        if( sys->context_mutex  != INVALID_HANDLE_VALUE )
+            ReleaseMutex( sys->context_mutex );
         goto error;
-
-    if( sys->context_mutex != INVALID_HANDLE_VALUE )
-        WaitForSingleObjectEx( sys->context_mutex, INFINITE, FALSE );
+    }
 
     ID3D11DeviceContext_CopySubresourceRegion(dst->p_sys->context,
                                               dst->p_sys->resource[KNOWN_DXGI_INDEX],
-- 
2.13.0



More information about the vlc-devel mailing list