From 44d4eb096d99cf13eaa763d1a36f8f290acff437 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 12 Mar 2024 00:45:15 +0900 Subject: [PATCH] cuda,d3d11,d3d12bufferpool: Disable preallocation Do not chain up to parent's GstBufferPool::start() which will do preallocation. We don't want it to be preallocated since there are various cases where negotiated downstream buffer pool is not used at all (e.g., zero-copy decoding, IPC elements). Part-of: --- .../gst-libs/gst/cuda/gstcudabufferpool.cpp | 2 +- .../gst-libs/gst/d3d11/gstd3d11bufferpool.cpp | 17 ----------------- .../sys/d3d12/gstd3d12bufferpool.cpp | 17 ----------------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudabufferpool.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudabufferpool.cpp index 6ea111f6e6..d933a0fad5 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudabufferpool.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudabufferpool.cpp @@ -211,7 +211,7 @@ gst_cuda_buffer_pool_start (GstBufferPool * pool) return FALSE; } - return GST_BUFFER_POOL_CLASS (parent_class)->start (pool); + return TRUE; } static gboolean diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp index d5a86b64c2..026a3c49e2 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp @@ -362,7 +362,6 @@ gst_d3d11_buffer_pool_start (GstBufferPool * pool) GstD3D11BufferPool *self = GST_D3D11_BUFFER_POOL (pool); GstD3D11BufferPoolPrivate *priv = self->priv; guint i; - gboolean ret; GST_DEBUG_OBJECT (self, "Start"); @@ -378,22 +377,6 @@ gst_d3d11_buffer_pool_start (GstBufferPool * pool) } } - ret = GST_BUFFER_POOL_CLASS (parent_class)->start (pool); - if (!ret) { - GST_ERROR_OBJECT (self, "Failed to start"); - - for (i = 0; i < G_N_ELEMENTS (priv->alloc); i++) { - GstD3D11Allocator *alloc = priv->alloc[i]; - - if (!alloc) - break; - - gst_d3d11_allocator_set_active (alloc, FALSE); - } - - return FALSE; - } - return TRUE; } diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp index 2d9635d8f2..81db0ab3c0 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp @@ -324,7 +324,6 @@ gst_d3d12_buffer_pool_start (GstBufferPool * pool) auto self = GST_D3D12_BUFFER_POOL (pool); auto priv = self->priv; guint i; - gboolean ret; GST_DEBUG_OBJECT (self, "Start"); @@ -340,22 +339,6 @@ gst_d3d12_buffer_pool_start (GstBufferPool * pool) } } - ret = GST_BUFFER_POOL_CLASS (parent_class)->start (pool); - if (!ret) { - GST_ERROR_OBJECT (self, "Failed to start"); - - for (i = 0; i < G_N_ELEMENTS (priv->alloc); i++) { - GstD3D12Allocator *alloc = priv->alloc[i]; - - if (!alloc) - break; - - gst_d3d12_allocator_set_active (alloc, FALSE); - } - - return FALSE; - } - return TRUE; }