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
This commit is contained in:
Wim Taymans 2021-12-23 11:38:54 +01:00
parent 3de9d3df3b
commit 08b18b9da4

View file

@ -1259,8 +1259,6 @@ static void stream_process(void *data)
pd.underrun = true; pd.underrun = true;
} }
if ((stream->attr.prebuf == 0 || do_flush) && !stream->corked) { if ((stream->attr.prebuf == 0 || do_flush) && !stream->corked) {
pd.missing = size;
pd.playing_for = size;
if (avail > 0) { if (avail > 0) {
spa_ringbuffer_read_data(&stream->ring, spa_ringbuffer_read_data(&stream->ring,
stream->buffer, stream->attr.maxlength, stream->buffer, stream->attr.maxlength,
@ -1268,6 +1266,11 @@ static void stream_process(void *data)
p, avail); p, avail);
index += avail; index += avail;
pd.read_inc = 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); spa_ringbuffer_read_update(&stream->ring, index);
} }