pw-cat: don't start drain on 0 request size

When the stream requests a 0 size buffer, don't start the drain but
simply queue a 0 size buffer.

Sometimes, switching quantums and drivers might request a 0 buffer
async and this should not cause a drain operation.
This commit is contained in:
Wim Taymans 2022-04-19 18:29:47 +02:00
parent 96286fb8b1
commit 32b2377de3

View file

@ -745,7 +745,7 @@ static void on_process(void *userdata)
n_fill_frames = data->fill(data, p, n_frames); n_fill_frames = data->fill(data, p, n_frames);
if (n_fill_frames > 0) { if (n_fill_frames > 0 || n_frames == 0) {
d->chunk->offset = 0; d->chunk->offset = 0;
d->chunk->stride = data->stride; d->chunk->stride = data->stride;
d->chunk->size = n_fill_frames * data->stride; d->chunk->size = n_fill_frames * data->stride;
@ -753,6 +753,9 @@ static void on_process(void *userdata)
b->size = n_frames; b->size = n_frames;
} else if (n_fill_frames < 0) { } else if (n_fill_frames < 0) {
fprintf(stderr, "fill error %d\n", n_fill_frames); fprintf(stderr, "fill error %d\n", n_fill_frames);
} else {
if (data->verbose)
printf("drain start\n");
} }
} else { } else {
offset = SPA_MIN(d->chunk->offset, d->maxsize); offset = SPA_MIN(d->chunk->offset, d->maxsize);