From 700a22b7f737252837032b93af7a55ded23a8196 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 29 Nov 2021 20:22:05 +0100 Subject: [PATCH] pulse-server: recover for underrun better If we are underrun, don't update the read pointer and let the write pointer catch up. If we don't have enough data to fill a buffer, skip all the available data and wait for the new request to arrive. Fixes #1857 --- src/modules/module-protocol-pulse/pulse-server.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index a047a2ea7..2fc88c8de 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -1243,8 +1243,10 @@ static void stream_process(void *data) if (stream->attr.prebuf == 0 && !stream->corked) { pd.missing = size; pd.playing_for = size; - index += size; - pd.read_inc = size; + if (avail > 0) { + index += avail; + pd.read_inc = avail; + } spa_ringbuffer_read_update(&stream->ring, index); } } else {