From 80a6583271c5d578df59feee8d9a1692a4ece42b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 22 Mar 2021 10:29:45 +0100 Subject: [PATCH] pulse-server: send any STREAM_KILLED command last Mark the stream as killed and then only send the STREAM_KILLED command after we send the other pending commands. --- src/modules/module-protocol-pulse/pulse-server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 6d7696760..9799ef705 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -241,6 +241,7 @@ struct stream { unsigned int is_underrun:1; unsigned int in_prebuf:1; unsigned int done:1; + unsigned int killed:1; }; struct server { @@ -1118,6 +1119,9 @@ static void stream_free(struct stream *stream) if (stream->drain_tag) reply_error(client, -1, stream->drain_tag, -ENOENT); + if (stream->killed) + send_stream_killed(stream); + /* force processing of all pending messages before we destroy * the stream */ pw_loop_invoke(impl->loop, NULL, 0, NULL, 0, false, client); @@ -1541,7 +1545,7 @@ static void stream_state_changed(void *data, enum pw_stream_state old, break; case PW_STREAM_STATE_UNCONNECTED: if (!client->disconnecting) - send_stream_killed(stream); + stream->killed = true; stream->done = true; break; case PW_STREAM_STATE_CONNECTING: