[vlc-commits] dxva: remove redundant hw.surface_count

Steve Lhomme git at videolan.org
Fri Oct 18 09:46:44 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Oct 17 17:10:01 2019 +0200| [dbf64bd9f87d855b6adc163d68d7c074e4996a0b] | committer: Steve Lhomme

dxva: remove redundant hw.surface_count

It's already read when we setup the decoder.

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

 modules/codec/avcodec/d3d11va.c             | 3 +--
 modules/codec/avcodec/dxva2.c               | 3 +--
 modules/codec/avcodec/va_surface.c          | 8 ++++----
 modules/codec/avcodec/va_surface_internal.h | 2 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 8fa15e640d..e0f4b66e01 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -142,10 +142,9 @@ static int DxCreateDecoderSurfaces(vlc_va_t *, int codec_id,
                                    const video_format_t *fmt, unsigned surface_count);
 static void DxDestroySurfaces(vlc_va_sys_t *);
 
-static void SetupAVCodecContext(vlc_va_sys_t *sys, unsigned surfaces)
+static void SetupAVCodecContext(vlc_va_sys_t *sys)
 {
     sys->hw.cfg = &sys->cfg;
-    sys->hw.surface_count = surfaces;
     sys->hw.surface = sys->hw_surface;
     sys->hw.context_mutex = sys->d3d_dev.context_mutex;
     sys->hw.workaround = sys->selected_decoder->workaround;
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 02f71b2028..23e73382d1 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -151,10 +151,9 @@ static int DxCreateVideoDecoder(vlc_va_t *, int codec_id,
                                 const video_format_t *, unsigned surface_count);
 static void DxDestroyVideoDecoder(vlc_va_sys_t *);
 
-static void SetupAVCodecContext(vlc_va_sys_t *sys, unsigned surfaces)
+static void SetupAVCodecContext(vlc_va_sys_t *sys)
 {
     sys->hw.cfg = &sys->cfg;
-    sys->hw.surface_count = surfaces;
     sys->hw.surface = sys->hw_surface;
     sys->hw.workaround = sys->selected_decoder->workaround;
 }
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index a14292e57b..88886cae9f 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -53,7 +53,7 @@ static void DestroyVideoDecoder(vlc_va_sys_t *sys, va_pool_t *va_pool)
     va_pool->surface_count = 0;
 }
 
-static int SetupSurfaces(vlc_va_t *, va_pool_t *, unsigned count);
+static int SetupSurfaces(vlc_va_t *, va_pool_t *);
 
 /* */
 int va_pool_SetupDecoder(vlc_va_t *va, va_pool_t *va_pool, const AVCodecContext *avctx,
@@ -89,12 +89,12 @@ int va_pool_SetupDecoder(vlc_va_t *va, va_pool_t *va_pool, const AVCodecContext
 
 done:
     if (err == VLC_SUCCESS)
-        err = SetupSurfaces(va, va_pool, count);
+        err = SetupSurfaces(va, va_pool);
 
     return err;
 }
 
-static int SetupSurfaces(vlc_va_t *va, va_pool_t *va_pool, unsigned count)
+static int SetupSurfaces(vlc_va_t *va, va_pool_t *va_pool)
 {
     int err = VLC_ENOMEM;
 
@@ -115,7 +115,7 @@ static int SetupSurfaces(vlc_va_t *va, va_pool_t *va_pool, unsigned count)
 
 done:
     if (err == VLC_SUCCESS)
-        va_pool->callbacks->pf_setup_avcodec_ctx(va->sys, count);
+        va_pool->callbacks->pf_setup_avcodec_ctx(va->sys);
 
     return err;
 }
diff --git a/modules/codec/avcodec/va_surface_internal.h b/modules/codec/avcodec/va_surface_internal.h
index 6be24bb253..9d34863610 100644
--- a/modules/codec/avcodec/va_surface_internal.h
+++ b/modules/codec/avcodec/va_surface_internal.h
@@ -66,7 +66,7 @@ struct va_pool_cfg {
     /**
      * Set the avcodec hw context after the decoder is created
      */
-    void (*pf_setup_avcodec_ctx)(vlc_va_sys_t *, unsigned surfaces);
+    void (*pf_setup_avcodec_ctx)(vlc_va_sys_t *);
 
     /**
      * Create a new context for the surface being acquired



More information about the vlc-commits mailing list