[PATCH 1/4] gstreamer: Fix reconfiguration condition check
Nicolas Dufresne
nicolas at ndufresne.ca
Tue Apr 22 16:29:49 CEST 2025
Le mardi 22 avril 2025 à 16:10 +0200, Jaslo Ziska a écrit :
> 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 <jaslo at ziska.de>
> ---
> src/gstreamer/gstlibcamerasrc.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index 5e9e843d..12bf8de0 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -548,7 +548,7 @@ 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)) {
> + if (gst_caps_is_empty(gst_pad_peer_query_caps(srcpad, caps))) {
This leaks the caps returned by the query. The the "peercaps" in an
autoptr to fix it. As per the method, that seems like the right
direction.
Nicolas
> reconfigure = true;
> break;
> }
More information about the libcamera-devel
mailing list