From 89bbcf0061b7a4b694fda793fe8648d66a7dd3d0 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 2 Mar 2022 20:55:29 +0900 Subject: [PATCH] cudabufferpool: Move GstCudaContext object to public member ... so that plugins can understand assosicated cuda context with the pool. Part-of: --- .../gst-plugins-bad/sys/nvcodec/gstcudabufferpool.c | 7 +++---- .../gst-plugins-bad/sys/nvcodec/gstcudabufferpool.h | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.c index a546268218..4e57742639 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.c @@ -30,7 +30,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_cuda_buffer_pool_debug); struct _GstCudaBufferPoolPrivate { - GstCudaContext *context; GstAllocator *allocator; GstVideoInfo info; gboolean add_videometa; @@ -90,7 +89,7 @@ gst_cuda_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) priv->allocator = gst_object_ref (allocator); } } else { - allocator = priv->allocator = gst_cuda_allocator_new (priv->context); + allocator = priv->allocator = gst_cuda_allocator_new (cuda_pool->context); if (G_UNLIKELY (priv->allocator == NULL)) goto no_allocator; } @@ -214,7 +213,7 @@ gst_cuda_buffer_pool_new (GstCudaContext * context) pool = g_object_new (GST_TYPE_CUDA_BUFFER_POOL, NULL); gst_object_ref_sink (pool); - pool->priv->context = gst_object_ref (context); + pool->context = gst_object_ref (context); GST_LOG_OBJECT (pool, "new CUDA buffer pool %p", pool); @@ -230,7 +229,7 @@ gst_cuda_buffer_pool_dispose (GObject * object) GST_LOG_OBJECT (pool, "finalize CUDA buffer pool %p", pool); gst_clear_object (&priv->allocator); - gst_clear_object (&priv->context); + gst_clear_object (&pool->context); G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.h b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.h index 8e1be07ee0..7f6075fae9 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.h +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.h @@ -46,6 +46,8 @@ struct _GstCudaBufferPool { GstBufferPool parent; + GstCudaContext *context; + GstCudaBufferPoolPrivate *priv; };