[vlc-devel] [PATCH 2/2] direct3d11: test the mutex existence with INVALID_HANDLE_VALUE not positive
Steve Lhomme
robux4 at videolabs.io
Mon Aug 1 09:23:52 CEST 2016
---
modules/codec/avcodec/d3d11va.c | 4 ++--
modules/video_output/win32/direct3d11.c | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index edf09b2..bf40ad6 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -262,7 +262,7 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
assert(p_sys_in->decoder == src);
#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
- if( sys->context_mutex > 0 ) {
+ if( sys->context_mutex != INVALID_HANDLE_VALUE ) {
WaitForSingleObjectEx( sys->context_mutex, INFINITE, FALSE );
}
#endif
@@ -334,7 +334,7 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
done:
#if LIBAVCODEC_VERSION_CHECK(57, 2, 0, 3, 100)
- if( sys->context_mutex > 0 ) {
+ if( sys->context_mutex != INVALID_HANDLE_VALUE ) {
ReleaseMutex( sys->context_mutex );
}
#endif
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 4a05c7b..c8a05fa 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -794,7 +794,7 @@ static void Manage(vout_display_t *vd)
RECTHeight(size_before) != RECTHeight(sys->rect_dest_clipped))
{
#if defined(HAVE_ID3D11VIDEODECODER)
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
}
@@ -806,7 +806,7 @@ static void Manage(vout_display_t *vd)
UpdatePicQuadPosition(vd);
#if defined(HAVE_ID3D11VIDEODECODER)
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
ReleaseMutex( sys->context_lock );
}
@@ -846,7 +846,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
#ifdef HAVE_ID3D11VIDEODECODER
if (is_d3d11_opaque(picture->format.i_chroma)) {
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
}
@@ -929,7 +929,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
/* TODO device lost */
}
#if defined(HAVE_ID3D11VIDEODECODER)
- if( is_d3d11_opaque(picture->format.i_chroma) && sys->context_lock > 0) {
+ if( is_d3d11_opaque(picture->format.i_chroma) && sys->context_lock != INVALID_HANDLE_VALUE) {
ReleaseMutex( sys->context_lock );
}
#endif
@@ -1298,14 +1298,14 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
UncropStagingFormat( vd, &core_source );
#if defined(HAVE_ID3D11VIDEODECODER)
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
}
#endif
if (Direct3D11CreateResources(vd, fmt)) {
#if defined(HAVE_ID3D11VIDEODECODER)
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
ReleaseMutex( sys->context_lock );
}
@@ -1315,7 +1315,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
return VLC_EGENERIC;
}
#if defined(HAVE_ID3D11VIDEODECODER)
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
ReleaseMutex( sys->context_lock );
}
@@ -1847,7 +1847,7 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
sys->pSPUPixelShader = NULL;
}
#if defined(HAVE_ID3D11VIDEODECODER)
- if( sys->context_lock > 0 )
+ if( sys->context_lock != INVALID_HANDLE_VALUE )
{
CloseHandle( sys->context_lock );
sys->context_lock = INVALID_HANDLE_VALUE;
--
2.8.2
More information about the vlc-devel
mailing list