From db2719f1f4d8cfe5a23b2ba06541608b9c7d4391 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 25 Jan 2022 15:21:31 +0100 Subject: [PATCH] pulse-server: always advance the read pointer in underrun We should always advance the read pointer when we are underrun and not corked. This will request more bytes from the client to make things advance. Fixes #2041 --- src/modules/module-protocol-pulse/pulse-server.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 3ca1468cf..7e6448390 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -1253,15 +1253,15 @@ static void stream_process(void *data) pd.underrun = true; } if ((stream->attr.prebuf == 0 || do_flush) && !stream->corked) { - pd.playing_for = size; if (avail > 0) { spa_ringbuffer_read_data(&stream->ring, stream->buffer, stream->attr.maxlength, index % stream->attr.maxlength, p, avail); - index += avail; - pd.read_inc = avail; } + pd.playing_for = size; + pd.read_inc = size; + index += size; spa_ringbuffer_read_update(&stream->ring, index); } pw_log_debug("%p: [%s] underrun read:%u avail:%d max:%u",