pulse-server: Handle clients that send more than requested

A client can sometimes send more data than we requested. PulseAudio
keeps the extra data around, it just asks for more data when it consumed
some of it.

PipeWire however always tries to keep tlength worth of data, as
specified in the PulseAudio docs... Keep track of how much extra data
has been sent and keep this around as well. Make sure we flush this
extra data as well.

Fixes #2626
This commit is contained in:
Wim Taymans 2022-09-07 13:07:28 +02:00
parent 50f76c8730
commit a79b5c86ea
3 changed files with 7 additions and 0 deletions

View file

@ -163,6 +163,7 @@ void stream_flush(struct stream *stream)
if (stream->attr.prebuf > 0)
stream->in_prebuf = true;
stream->extra_tlength = 0;
stream->playing_for = 0;
stream->underrun_for = -1;
stream->is_underrun = true;
@ -193,6 +194,7 @@ uint32_t stream_pop_missing(struct stream *stream)
avail = stream->write_index - stream->read_index;
missing = stream->attr.tlength;
missing += stream->extra_tlength;
missing -= stream->requested;
missing -= avail;