From 32b2377de3ed386fc5b719cc660c00f88d4fc976 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 19 Apr 2022 18:29:47 +0200 Subject: [PATCH] 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. --- src/tools/pw-cat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index 1409a3048..e9bdd8c19 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -745,7 +745,7 @@ static void on_process(void *userdata) 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->stride = data->stride; d->chunk->size = n_fill_frames * data->stride; @@ -753,6 +753,9 @@ static void on_process(void *userdata) b->size = n_frames; } else if (n_fill_frames < 0) { fprintf(stderr, "fill error %d\n", n_fill_frames); + } else { + if (data->verbose) + printf("drain start\n"); } } else { offset = SPA_MIN(d->chunk->offset, d->maxsize);