From 36bec972d3b8c45335ea385475c41e0fb0ac2310 Mon Sep 17 00:00:00 2001 From: Jaslo Ziska Date: Tue, 22 Jul 2025 12:39:28 +0200 Subject: [PATCH] gstreamer: Fix reconfiguration condition check gst_pad_peer_query_accept_caps() might only check if the caps are acceptable with the peer element, but not recursively with all downstream elements. If the reconfigure flag was set because the pipeline downstream changed, gst_pad_peer_query_accept_caps() might still return true, even though downstream can't handle the current caps, which causes a not-negotiated error. This commit fixes this issue by emitting a query event which recursively checks with all downstream elements. Because at this point we are only interested in whether the current caps are still acceptable, use the currently used caps as a filter and then check if the query returned empty caps. Signed-off-by: Jaslo Ziska Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Nicolas Dufresne Signed-off-by: Laurent Pinchart --- src/gstreamer/gstlibcamerasrc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 3aca4eed..7f4a39ec 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -730,7 +730,8 @@ gst_libcamera_src_task_run(gpointer user_data) if (gst_pad_check_reconfigure(srcpad)) { /* Check if the caps even need changing. */ g_autoptr(GstCaps) caps = gst_pad_get_current_caps(srcpad); - if (!gst_pad_peer_query_accept_caps(srcpad, caps)) { + g_autoptr(GstCaps) peercaps = gst_pad_peer_query_caps(srcpad, caps); + if (gst_caps_is_empty(peercaps)) { reconfigure = true; break; }