From 2ab773ce14e89cdaf7c52bc2a993be5ce04b8ee7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 24 Sep 2024 10:50:14 +0200 Subject: [PATCH] stream: emit the Pause command early Don't wait for the completion of the Pause command of the node but send it to the stream immediately. Delaying it might make it come after the set_param calls are done and confuse the stream. --- src/pipewire/stream.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index fd045af5f..27169d28f 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -668,8 +668,10 @@ static int impl_send_command(void *object, const struct spa_command *command) case SPA_NODE_COMMAND_Pause: pw_loop_invoke(impl->main_loop, NULL, 0, NULL, 0, false, impl); - if (stream->state == PW_STREAM_STATE_STREAMING) + if (stream->state == PW_STREAM_STATE_STREAMING) { pw_log_debug("%p: pause", stream); + stream_set_state(stream, PW_STREAM_STATE_PAUSED, 0, NULL); + } break; case SPA_NODE_COMMAND_Start: if (stream->state == PW_STREAM_STATE_PAUSED) { @@ -1389,10 +1391,6 @@ static void node_state_changed(void *data, enum pw_node_state old, struct pw_stream *stream = data; switch (state) { - case PW_NODE_STATE_IDLE: - if (stream->state == PW_STREAM_STATE_STREAMING) - stream_set_state(stream, PW_STREAM_STATE_PAUSED, 0, NULL); - break; case PW_NODE_STATE_RUNNING: if (stream->state == PW_STREAM_STATE_PAUSED) stream_set_state(stream, PW_STREAM_STATE_STREAMING, 0, NULL);