v4l2codecs: Release sink allocator when deciding allocation

All decoders have the same design pattern in decide allocation
and forgot to release sink allocator before allocating a new one.
Fixing the memory leak by clearing sink allocator before creating
the new one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8583>
This commit is contained in:
Benjamin Gaignard 2025-03-04 11:04:56 +01:00 committed by GStreamer Marge Bot
parent 0d1cc08176
commit 95a3c0123f
6 changed files with 6 additions and 0 deletions

View File

@ -416,6 +416,7 @@ gst_v4l2_codec_av1_dec_decide_allocation (GstVideoDecoder * decoder,
g_clear_object (&self->src_pool);
g_clear_object (&self->src_allocator);
g_clear_object (&self->sink_allocator);
self->has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);

View File

@ -462,6 +462,7 @@ gst_v4l2_codec_h264_dec_decide_allocation (GstVideoDecoder * decoder,
g_clear_object (&self->src_pool);
g_clear_object (&self->src_allocator);
g_clear_object (&self->sink_allocator);
self->has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);

View File

@ -490,6 +490,7 @@ gst_v4l2_codec_h265_dec_decide_allocation (GstVideoDecoder * decoder,
g_clear_object (&self->src_pool);
g_clear_object (&self->src_allocator);
g_clear_object (&self->sink_allocator);
self->has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);

View File

@ -384,6 +384,7 @@ gst_v4l2_codec_mpeg2_dec_decide_allocation (GstVideoDecoder * decoder,
g_clear_object (&self->src_pool);
g_clear_object (&self->src_allocator);
g_clear_object (&self->sink_allocator);
self->has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);

View File

@ -343,6 +343,7 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder,
g_clear_object (&self->src_pool);
g_clear_object (&self->src_allocator);
g_clear_object (&self->sink_allocator);
self->has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);

View File

@ -613,6 +613,7 @@ gst_v4l2_codec_vp9_dec_decide_allocation (GstVideoDecoder * decoder,
g_clear_object (&self->src_pool);
g_clear_object (&self->src_allocator);
g_clear_object (&self->sink_allocator);
self->has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);