From 08b18b9da48b8eaba78b4f2a7a81ffe3116625b2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 23 Dec 2021 11:38:54 +0100 Subject: [PATCH] pulse-server: use partial data as missing/played for When we can't fill a complete block, report the amount of data that we used in missing/played instead of the complete missing part. Fixes audio breaking up when looping in mpv. Fixes #1132 --- 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 cdc2a955c..aa7ce29cc 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -1259,8 +1259,6 @@ static void stream_process(void *data) pd.underrun = true; } if ((stream->attr.prebuf == 0 || do_flush) && !stream->corked) { - pd.missing = size; - pd.playing_for = size; if (avail > 0) { spa_ringbuffer_read_data(&stream->ring, stream->buffer, stream->attr.maxlength, @@ -1268,6 +1266,11 @@ static void stream_process(void *data) p, avail); index += avail; pd.read_inc = avail; + pd.missing = avail; + pd.playing_for = avail; + } else { + pd.missing = size; + pd.playing_for = size; } spa_ringbuffer_read_update(&stream->ring, index); }