From dcda6c259f0d90bfa8629ca3ba56ba1fa8f82b9d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 16 Nov 2020 15:42:04 +0100 Subject: [PATCH] pulse-server: send drain only once --- src/modules/module-protocol-pulse/pulse-server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 67f96a769..474c0b38c 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -181,6 +181,7 @@ struct stream { uint32_t drain_tag; unsigned int corked:1; + unsigned int draining:1; unsigned int volume_set:1; unsigned int muted_set:1; unsigned int adjust_latency:1; @@ -1385,9 +1386,10 @@ static void stream_process(void *data) size = buf->datas[0].maxsize; memset(p, 0, size); - if (stream->drain_tag) + if (stream->draining) { + stream->draining = false; pw_stream_flush(stream->stream, true); - else { + } else { pd.underrun_for = size; pd.underrun = true; } @@ -3142,6 +3144,7 @@ static int do_drain_stream(struct client *client, uint32_t command, uint32_t tag return -ENOENT; stream->drain_tag = tag; + stream->draining = true; return 0; }