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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2013>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-02-15 15:34:56 +01:00
parent 0ec17904e1
commit 21ce99b209

View file

@ -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 static gboolean
gst_va_pool_start (GstBufferPool * pool) gst_va_pool_start (GstBufferPool * pool)
{ {
@ -294,6 +283,22 @@ gst_va_pool_start (GstBufferPool * pool)
return ret; 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 static void
gst_va_pool_dispose (GObject * object) 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->get_options = gst_va_pool_get_options;
gstbufferpool_class->set_config = gst_va_pool_set_config; gstbufferpool_class->set_config = gst_va_pool_set_config;
gstbufferpool_class->alloc_buffer = gst_va_pool_alloc; 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->start = gst_va_pool_start;
gstbufferpool_class->stop = gst_va_pool_stop;
} }
static void static void