[vlc-commits] dxva2: do not keep a reference to the IDirectXVideoDecoder

Steve Lhomme git at videolan.org
Wed Oct 23 15:37:45 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jul  8 15:07:55 2019 +0200| [37be1cdc62628cbe1098c26a3ac3b040357742de] | committer: Steve Lhomme

dxva2: do not keep a reference to the IDirectXVideoDecoder

We already have a reference on the surface.

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

 modules/codec/avcodec/dxva2.c   | 5 ++---
 modules/video_chroma/d3d9_fmt.h | 7 -------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 0d9520804d..aa9a8abf31 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -183,7 +183,7 @@ static picture_context_t *dxva2_pic_context_copy(picture_context_t *ctx)
     return &pic_ctx->ctx.s;
 }
 
-static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface, IDirectXVideoDecoder *decoder)
+static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface)
 {
     struct dxva2_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
     if (unlikely(pic_ctx==NULL))
@@ -192,7 +192,6 @@ static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface, ID
         dxva2_pic_context_destroy, dxva2_pic_context_copy,
     };
     pic_ctx->ctx.picsys.surface = surface;
-    pic_ctx->ctx.picsys.decoder = decoder;
     AcquireD3D9PictureSys(&pic_ctx->ctx.picsys);
     return pic_ctx;
 }
@@ -200,7 +199,7 @@ static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface, ID
 static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *va_surface)
 {
     vlc_va_sys_t *sys = va->sys;
-    struct dxva2_pic_context *pic_ctx = CreatePicContext(sys->hw_surface[va_surface_GetIndex(va_surface)], sys->hw.decoder);
+    struct dxva2_pic_context *pic_ctx = CreatePicContext(sys->hw_surface[va_surface_GetIndex(va_surface)]);
     if (unlikely(pic_ctx==NULL))
         return NULL;
     pic_ctx->va_surface = va_surface;
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 5dd312ceba..e6d0bd5bec 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -28,7 +28,6 @@
 
 #define COBJMACROS
 #include <d3d9.h>
-#include <dxva2api.h>
 
 #include "dxgi_fmt.h"
 
@@ -36,8 +35,6 @@
 typedef struct
 {
     IDirect3DSurface9    *surface;
-    /* decoder only */
-    IDirectXVideoDecoder *decoder; /* keep a reference while the surface exist */
     HINSTANCE            dxva2_dll;
 } picture_sys_d3d9_t;
 
@@ -130,16 +127,12 @@ static inline d3d9_video_context_t *GetD3D9ContextPrivate(vlc_video_context *vct
 static inline void AcquireD3D9PictureSys(picture_sys_d3d9_t *p_sys)
 {
     IDirect3DSurface9_AddRef(p_sys->surface);
-    if (p_sys->decoder)
-        IDirectXVideoDecoder_AddRef(p_sys->decoder);
     p_sys->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
 }
 
 static inline void ReleaseD3D9PictureSys(picture_sys_d3d9_t *p_sys)
 {
     IDirect3DSurface9_Release(p_sys->surface);
-    if (p_sys->decoder)
-        IDirectXVideoDecoder_Release(p_sys->decoder);
     FreeLibrary(p_sys->dxva2_dll);
 }
 



More information about the vlc-commits mailing list