1
Fork 0

gstpipewiresrc: break out of wait_started() also on STATE_UNCONNECTED

When the session manager sends an error to the client, it typically
also destroys the node after the error, which causes the stream to go
to STATE_UNCONNECTED via proxy_removed(). In that case, make sure
we exit the loop early, otherwise it will take 30 seconds to unblock
gst_element_set_state()

This is a revised version of the fix that was commited via !1763
and then reverted, as it was problematic. Now the code ensures
that it breaks out only if the state was previously CONNECTING
or higher.
This commit is contained in:
George Kiagiadakis 2023-12-22 16:01:42 +02:00 committed by Wim Taymans
parent 03173530da
commit 5a130ddd73
1 changed files with 6 additions and 5 deletions

View File

@ -768,7 +768,7 @@ start_error:
static enum pw_stream_state
wait_started (GstPipeWireSrc *this)
{
enum pw_stream_state state;
enum pw_stream_state state, prev_state = PW_STREAM_STATE_UNCONNECTED;
const char *error = NULL;
struct timespec abstime;
@ -783,10 +783,9 @@ wait_started (GstPipeWireSrc *this)
GST_DEBUG_OBJECT (this, "waiting for started signal, state now %s",
pw_stream_state_as_string (state));
if (state == PW_STREAM_STATE_ERROR)
break;
if (this->flushing) {
if (state == PW_STREAM_STATE_ERROR ||
(state == PW_STREAM_STATE_UNCONNECTED && prev_state > PW_STREAM_STATE_UNCONNECTED) ||
this->flushing) {
state = PW_STREAM_STATE_ERROR;
break;
}
@ -798,6 +797,8 @@ wait_started (GstPipeWireSrc *this)
state = PW_STREAM_STATE_ERROR;
break;
}
prev_state = state;
}
GST_DEBUG_OBJECT (this, "got started signal: %s",
pw_stream_state_as_string (state));