diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-v4l2codecs-Always-chain-up-to-parent-decide_allocati.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-v4l2codecs-Always-chain-up-to-parent-decide_allocati.patch new file mode 100644 index 0000000000..8906b55082 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-v4l2codecs-Always-chain-up-to-parent-decide_allocati.patch @@ -0,0 +1,87 @@ +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 */ diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.22.12.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.22.12.bb index e4fa2a412f..f6d0711bd8 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.22.12.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.22.12.bb @@ -9,6 +9,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad file://0001-fix-maybe-uninitialized-warnings-when-compiling-with.patch \ file://0002-avoid-including-sys-poll.h-directly.patch \ file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \ + file://0005-v4l2codecs-Always-chain-up-to-parent-decide_allocati.patch \ file://CVE-2025-3887-1.patch \ file://CVE-2025-3887-2.patch \ "