From 98b1b8090dbffe1dfa6e1883b2550008833a568a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 31 Oct 2020 15:22:32 +0100 Subject: [PATCH] pulse-server: don't underrun when draining --- src/modules/module-protocol-pulse/pulse-server.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index a41622800..dbc524318 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -1276,13 +1276,15 @@ static void stream_process(void *data) int32_t avail = spa_ringbuffer_get_read_index(&stream->ring, &pd.read_index); if (avail <= 0) { /* underrun */ - if (stream->drain_tag) - pw_stream_flush(stream->stream, true); - size = buf->datas[0].maxsize; memset(p, 0, size); - pd.underrun_for = size; - pd.underrun = true; + + if (stream->drain_tag) + pw_stream_flush(stream->stream, true); + else { + pd.underrun_for = size; + pd.underrun = true; + } } else if (avail > MAXLENGTH) { /* overrun, handled by other side */ pw_log_warn(NAME" %p: overrun", stream);