pipewire: Fix GST hang for unavailable cameras
[AGL/meta-agl.git] / meta-pipewire / recipes-multimedia / pipewire / pipewire / 0003-gstpipewiresrc-break-out-of-wait_started-also-on-STA.patch
1 From 4fb8417b201033ae2de20032b44d52cae1394ff8 Mon Sep 17 00:00:00 2001
2 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
3 Date: Wed, 8 Nov 2023 18:23:02 +0200
4 Subject: [PATCH 2/2] gstpipewiresrc: break out of wait_started() also on
5  STATE_UNCONNECTED
6
7 When the session manager sends an error to the client, it typically
8 also destroys the node after the error, which causes the stream to go
9 to STATE_UNCONNECTED via proxy_removed(). In that case, make sure
10 we exit the loop early, otherwise it will take 30 seconds to unblock
11 gst_element_set_state()
12
13 Upstream-Status: Pipewire MR1763 merged
14 ---
15  src/gst/gstpipewiresrc.c | 7 +++----
16  1 file changed, 3 insertions(+), 4 deletions(-)
17
18 diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c
19 index e473338ba..e3b86b373 100644
20 --- a/src/gst/gstpipewiresrc.c
21 +++ b/src/gst/gstpipewiresrc.c
22 @@ -783,10 +783,9 @@ wait_started (GstPipeWireSrc *this)
23      GST_DEBUG_OBJECT (this, "waiting for started signal, state now %s",
24          pw_stream_state_as_string (state));
25
26 -    if (state == PW_STREAM_STATE_ERROR)
27 -      break;
28 -
29 -    if (this->flushing) {
30 +    if (state == PW_STREAM_STATE_ERROR ||
31 +        state == PW_STREAM_STATE_UNCONNECTED ||
32 +        this->flushing) {
33        state = PW_STREAM_STATE_ERROR;
34        break;
35      }
36 --
37 2.41.0
38