[vlc-devel] [PATCH 8/8] nvdec: use our own picture that is cancelable externally

Steve Lhomme robux4 at ycbcr.xyz
Mon Jul 27 15:45:29 CEST 2020


We don't use decoder_NewPicture() anymore so the cancellation on close needs to
be done on our pool, not the unused one in decoder.c.
---
 modules/hw/nvdec/nvdec.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 7cad7d8b239..50fa8c151de 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -155,7 +155,8 @@ static void nvdec_pool_Release(nvdec_pool_t *pool)
 static nvdec_pool_t* nvdec_pool_Create(vlc_video_context *vctx,
                                        const video_format_t *fmt,
                                        size_t buffer_pitch,
-                                       size_t buffer_height)
+                                       size_t buffer_height,
+                                       vlc_cancelable *pool_cancel)
 {
     vlc_decoder_device *dec_dev = NULL;
     nvdec_pool_t *pool = calloc(1, sizeof(*pool));
@@ -190,7 +191,7 @@ static nvdec_pool_t* nvdec_pool_Create(vlc_video_context *vctx,
             goto free_pool;
     }
 
-    pool->picture_pool = picture_pool_New(ARRAY_SIZE(pool->outputDevicePtr), pics, NULL);
+    pool->picture_pool = picture_pool_New(ARRAY_SIZE(pool->outputDevicePtr), pics, pool_cancel);
     if (!pool->picture_pool)
         goto free_pool;
 
@@ -455,8 +456,8 @@ static int CUDAAPI HandleVideoSequence(void *p_opaque, CUVIDEOFORMAT *p_format)
 
         p_sys->out_pool = nvdec_pool_Create(p_sys->vctx_out,
                                             &p_dec->fmt_out.video,
-                                            ByteWidth,
-                                            Height);
+                                            ByteWidth, Height,
+                                            p_dec->pool_cancel);
     }
     else
     {
@@ -1066,6 +1067,8 @@ static int OpenDecoder(vlc_object_t *p_this)
         goto error;
     }
 
+    p_dec->b_external_pool = true;
+
     vlc_fourcc_t output_chromas[3];
     size_t chroma_idx = 0;
     output_chromas[chroma_idx++] = MapSurfaceOpaqueChroma(cudaChroma, i_depth_luma);
-- 
2.26.2



More information about the vlc-devel mailing list