From 85fa0aae408f342f84359ae1d6cb7b4fd252df56 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Thu, 12 Dec 2024 11:11:21 -0500 Subject: [PATCH] gst: src: Set possible_caps before stream connect The value is used when a the format changes in handle_format_change(), and while it seems this was typically expected to happen async and thus protected by the thread lock, there are cases (such as with auto-port-config) where a param might be set within the pw_stream_connect() call itself (in the case of auto-port-config, by the impl_init() of the audioadapter). --- src/gst/gstpipewiresrc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 83d8b31d6..945bb0013 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -955,6 +955,9 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc) GST_DEBUG_OBJECT (basesrc, "connect capture with path %s, target-object %s", pwsrc->stream->path, pwsrc->stream->target_object); + pwsrc->possible_caps = possible_caps; + pwsrc->negotiated = FALSE; + enum pw_stream_flags flags; flags = PW_STREAM_FLAG_DONT_RECONNECT | PW_STREAM_FLAG_ASYNC; @@ -970,9 +973,6 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc) pw_thread_loop_get_time (pwsrc->stream->core->loop, &abstime, GST_PIPEWIRE_DEFAULT_TIMEOUT * SPA_NSEC_PER_SEC); - pwsrc->possible_caps = possible_caps; - pwsrc->negotiated = FALSE; - while (TRUE) { enum pw_stream_state state = pw_stream_get_state (pwsrc->stream->pwstream, &error);