pulse-server: don't clamp missing bytes to tlength

When we increase the quantum past the tlength, we need to be able to
ask for more bytes than the tlength or else we will never exit this
underrun state. Look at the last required bytes and use that if it's
larger then tlength.
This commit is contained in:
Wim Taymans 2021-12-03 16:43:16 +01:00
parent 1b94b66924
commit 16665d74d2

View file

@ -1096,6 +1096,7 @@ struct process_data {
uint32_t underrun_for;
uint32_t playing_for;
uint32_t missing;
uint32_t maxmissing;
unsigned int underrun:1;
};
@ -1134,7 +1135,7 @@ do_process_done(struct spa_loop *loop,
stream_send_started(stream);
}
stream->missing += pd->missing;
stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
stream->missing = SPA_MIN(stream->missing, pd->maxmissing);
stream->playing_for += pd->playing_for;
if (stream->underrun_for != (uint64_t)-1)
stream->underrun_for += pd->underrun_for;
@ -1228,6 +1229,8 @@ static void stream_process(void *data)
if (minreq == 0)
minreq = stream->attr.minreq;
pd.maxmissing = SPA_MAX(minreq, stream->attr.tlength);
if (avail < (int32_t)minreq || stream->corked) {
/* underrun, produce a silence buffer */
size = SPA_MIN(buf->datas[0].maxsize, minreq);