From 21ce99b20979fab1ec158703adff4d06cc5c1e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 15 Feb 2021 15:34:56 +0100 Subject: [PATCH] va: pool, allocator: free memories at bufferpool's stop() This patch frees the memories in the allocator's pool after the bufferpool frees all its buffers, sync'ing them at stop() vmethod. By doing it, the current logic in flush_start() is not valid, so the vmethod is removed. Part-of: --- sys/va/gstvapool.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/sys/va/gstvapool.c b/sys/va/gstvapool.c index 449e9c21c0..0d07bea298 100644 --- a/sys/va/gstvapool.c +++ b/sys/va/gstvapool.c @@ -270,17 +270,6 @@ no_memory: } } -static void -gst_va_pool_flush_start (GstBufferPool * pool) -{ - GstVaPool *vpool = GST_VA_POOL (pool); - - if (GST_IS_VA_DMABUF_ALLOCATOR (vpool->allocator)) - gst_va_dmabuf_allocator_flush (vpool->allocator); - else if (GST_IS_VA_ALLOCATOR (vpool->allocator)) - gst_va_allocator_flush (vpool->allocator); -} - static gboolean gst_va_pool_start (GstBufferPool * pool) { @@ -294,6 +283,22 @@ gst_va_pool_start (GstBufferPool * pool) return ret; } +static gboolean +gst_va_pool_stop (GstBufferPool * pool) +{ + GstVaPool *vpool = GST_VA_POOL (pool); + gboolean ret; + + ret = GST_BUFFER_POOL_CLASS (parent_class)->stop (pool); + + if (GST_IS_VA_DMABUF_ALLOCATOR (vpool->allocator)) + gst_va_dmabuf_allocator_flush (vpool->allocator); + else if (GST_IS_VA_ALLOCATOR (vpool->allocator)) + gst_va_allocator_flush (vpool->allocator); + + return ret; +} + static void gst_va_pool_dispose (GObject * object) { @@ -317,8 +322,8 @@ gst_va_pool_class_init (GstVaPoolClass * klass) gstbufferpool_class->get_options = gst_va_pool_get_options; gstbufferpool_class->set_config = gst_va_pool_set_config; gstbufferpool_class->alloc_buffer = gst_va_pool_alloc; - gstbufferpool_class->flush_start = gst_va_pool_flush_start; gstbufferpool_class->start = gst_va_pool_start; + gstbufferpool_class->stop = gst_va_pool_stop; } static void