cudabufferpool: Move GstCudaContext object to public member
authorSeungha Yang <seungha@centricular.com>
Wed, 2 Mar 2022 11:55:29 +0000 (20:55 +0900)
committerSeungha Yang <seungha@centricular.com>
Sun, 6 Mar 2022 15:39:04 +0000 (15:39 +0000)
... so that plugins can understand assosicated cuda context with the
pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>

subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.c
subprojects/gst-plugins-bad/sys/nvcodec/gstcudabufferpool.h

index a546268..4e57742 100644 (file)
@@ -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);
 }
index 8e1be07..7f6075f 100644 (file)
@@ -46,6 +46,8 @@ struct _GstCudaBufferPool
 {
   GstBufferPool parent;
 
+  GstCudaContext *context;
+
   GstCudaBufferPoolPrivate *priv;
 };