From b7988b4de8e3539e779711b57915f172936f193a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 17 Feb 2021 18:30:10 +0100 Subject: [PATCH] va: filter: destroy pipeline buffer after destroying filters In 6ae24948 the pipeline buffer destroy were removing assuming it wasn't required. Nonetheless, debugging the code it looks like a buffer leak in iHD driver since the ID of the buffer kept increasing. The difference now is that first the filter buffers are destroy first and later the pipeline buffer. Part-of: --- sys/va/gstvafilter.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/va/gstvafilter.c b/sys/va/gstvafilter.c index 4ce0827046..c085896709 100644 --- a/sys/va/gstvafilter.c +++ b/sys/va/gstvafilter.c @@ -906,7 +906,7 @@ _destroy_filters_unlocked (GstVaFilter * self) gboolean ret = TRUE; guint i; - GST_TRACE_OBJECT (self, "Destroy filter buffers"); + GST_TRACE_OBJECT (self, "Destroying %u filter buffers", self->filters->len); dpy = gst_va_display_get_va_dpy (self->display); @@ -1005,6 +1005,9 @@ _create_pipeline_buffer (GstVaFilter * self, VASurfaceID surface, return FALSE; } + GST_TRACE_OBJECT (self, "Created VABufferID %#x with %u filters", *buffer, + num_filters); + return TRUE; } @@ -1099,6 +1102,14 @@ bail: g_array_unref (self->filters); _destroy_filters_unlocked (self); } + + gst_va_display_lock (self->display); + status = vaDestroyBuffer (dpy, buffer); + gst_va_display_unlock (self->display); + if (status != VA_STATUS_SUCCESS) { + GST_WARNING_OBJECT (self, "Failed to destroy pipeline buffer: %s", + vaErrorStr (status)); + } GST_OBJECT_UNLOCK (self); return ret;