pulse-server: always use rate_match value when available

The minreq is just a fallback for when we don't know the exact
amount of required samples to consume from the ringbuffer.
This commit is contained in:
Wim Taymans 2021-01-16 17:16:02 +01:00
parent 02295c5e2b
commit bf25fc1388

View file

@ -1444,9 +1444,10 @@ static void stream_process(void *data)
if (stream->direction == PW_DIRECTION_OUTPUT) { if (stream->direction == PW_DIRECTION_OUTPUT) {
int32_t avail = spa_ringbuffer_get_read_index(&stream->ring, &pd.read_index); int32_t avail = spa_ringbuffer_get_read_index(&stream->ring, &pd.read_index);
minreq = SPA_MAX(stream->minblock, stream->attr.minreq);
if (stream->rate_match) if (stream->rate_match)
minreq = SPA_MIN(minreq, stream->rate_match->size * stream->frame_size); minreq = stream->rate_match->size * stream->frame_size;
else
minreq = SPA_MAX(stream->minblock, stream->attr.minreq);
if (avail <= 0) { if (avail <= 0) {
/* underrun, produce a silence buffer */ /* underrun, produce a silence buffer */
size = SPA_MIN(buf->datas[0].maxsize, minreq); size = SPA_MIN(buf->datas[0].maxsize, minreq);