[vlc-devel] [PATCH 07/23] directx_va: do the d3ddec release in pf_destroy_video_service()

Steve Lhomme robux4 at videolabs.io
Wed Jun 21 14:14:52 CEST 2017


And make the release strongly typed
---
 modules/codec/avcodec/d3d11va.c    | 4 +++-
 modules/codec/avcodec/directx_va.c | 2 --
 modules/codec/avcodec/dxva2.c      | 3 +++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index e049773bc9..909fc01927 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -610,7 +610,9 @@ static int DxCreateVideoService(vlc_va_t *va)
  */
 static void DxDestroyVideoService(vlc_va_t *va)
 {
-    VLC_UNUSED(va);
+    directx_sys_t *dx_sys = &va->sys->dx_sys;
+    if (dx_sys->d3ddec)
+        ID3D11VideoDevice_Release(dx_sys->d3ddec);
 }
 
 static void ReleaseInputList(input_list_t *p_list)
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 90c85d8499..f98a91e4cd 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -433,8 +433,6 @@ void directx_va_Close(vlc_va_t *va, directx_sys_t *dx_sys)
 {
     DestroyVideoDecoder(va, dx_sys);
     dx_sys->pf_destroy_video_service(va);
-    if (dx_sys->d3ddec)
-        IUnknown_Release(dx_sys->d3ddec);
     if (dx_sys->pf_destroy_device_manager)
         dx_sys->pf_destroy_device_manager(va);
     dx_sys->pf_destroy_device(va);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 10a8608b45..61d35ea555 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -562,8 +562,11 @@ static int DxCreateVideoService(vlc_va_t *va)
  */
 static void DxDestroyVideoService(vlc_va_t *va)
 {
+    directx_sys_t *dx_sys = &va->sys->dx_sys;
     if (va->sys->device)
         IDirect3DDeviceManager9_CloseDeviceHandle(va->sys->devmng, va->sys->device);
+    if (dx_sys->d3ddec)
+        IDirectXVideoDecoderService_Release(dx_sys->d3ddec);
 }
 
 static void ReleaseInputList(input_list_t *p_list)
-- 
2.12.1



More information about the vlc-devel mailing list