From 4e96cc4df0b6807cb487368afca64e022078ed6a Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Sun, 14 May 2023 13:23:17 +0100 Subject: [PATCH] v4l2codecs: Always chain up to parent decide_allocation function The `gst_video_decoder_negotiate_pool` function expects the `decide_allocation` function to always provide a pool and will fail to negotiate if the pool is missing. If we return immediately (even if we don't need to do anything special) negotiation will fail if the downstream element does not propose a pool. Fix by chaining up to the default `decide_allocation` function which adds a fallback pool if one was not already proposed. Part-of: Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/70ff80a873d8202329df1731c06f1bfed464ad2a] Signed-off-by: Daniel Semkowicz --- sys/v4l2codecs/gstv4l2codech264dec.c | 3 ++- sys/v4l2codecs/gstv4l2codech265dec.c | 3 ++- sys/v4l2codecs/gstv4l2codecvp8dec.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/v4l2codecs/gstv4l2codech264dec.c b/sys/v4l2codecs/gstv4l2codech264dec.c index 1a6b144e9b..bd9041533b 100644 --- a/sys/v4l2codecs/gstv4l2codech264dec.c +++ b/sys/v4l2codecs/gstv4l2codech264dec.c @@ -417,7 +417,7 @@ gst_v4l2_codec_h264_dec_decide_allocation (GstVideoDecoder * decoder, /* If we are streaming here, then it means there is nothing allocation * related in the new state and allocation can be ignored */ if (self->streaming) - return TRUE; + goto no_internal_changes; self->has_videometa = gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); @@ -452,6 +452,7 @@ gst_v4l2_codec_h264_dec_decide_allocation (GstVideoDecoder * decoder, self->src_pool = gst_v4l2_codec_pool_new (self->src_allocator, &self->vinfo); +no_internal_changes: /* Our buffer pool is internal, we will let the base class create a video * pool, and use it if we are running out of buffers or if downstream does * not support GstVideoMeta */ diff --git a/sys/v4l2codecs/gstv4l2codech265dec.c b/sys/v4l2codecs/gstv4l2codech265dec.c index 8d70d05220..3f0c08d6a4 100644 --- a/sys/v4l2codecs/gstv4l2codech265dec.c +++ b/sys/v4l2codecs/gstv4l2codech265dec.c @@ -446,7 +446,7 @@ gst_v4l2_codec_h265_dec_decide_allocation (GstVideoDecoder * decoder, guint min = 0; if (self->streaming) - return TRUE; + goto no_internal_changes; self->has_videometa = gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); @@ -465,6 +465,7 @@ gst_v4l2_codec_h265_dec_decide_allocation (GstVideoDecoder * decoder, GST_PAD_SRC, self->min_pool_size + min + 1); self->src_pool = gst_v4l2_codec_pool_new (self->src_allocator, &self->vinfo); +no_internal_changes: /* Our buffer pool is internal, we will let the base class create a video * pool, and use it if we are running out of buffers or if downstream does * not support GstVideoMeta */ diff --git a/sys/v4l2codecs/gstv4l2codecvp8dec.c b/sys/v4l2codecs/gstv4l2codecvp8dec.c index ba63a029df..bdea1fdf76 100644 --- a/sys/v4l2codecs/gstv4l2codecvp8dec.c +++ b/sys/v4l2codecs/gstv4l2codecvp8dec.c @@ -284,7 +284,7 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder, guint num_bitstream; if (self->streaming) - return TRUE; + goto no_internal_changes; self->has_videometa = gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); @@ -319,6 +319,7 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder, self->src_pool = gst_v4l2_codec_pool_new (self->src_allocator, &self->vinfo); +no_internal_changes: /* Our buffer pool is internal, we will let the base class create a video * pool, and use it if we are running out of buffers or if downstream does * not support GstVideoMeta */