From 777a8c687b5a113871e4c5e21908b3a39d9370c4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 May 2022 16:55:53 +0200 Subject: [PATCH] audio-src: queued only requested frames Use the new requested buffer field to only queue the amount of samples required by the resampler for the current quantum. This avoid spikes when the maxsize block of samples is processed. Fixes #2353 --- src/examples/audio-src.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/audio-src.c b/src/examples/audio-src.c index 561672d71..f65f6148a 100644 --- a/src/examples/audio-src.c +++ b/src/examples/audio-src.c @@ -93,7 +93,7 @@ static void on_process(void *userdata) return; stride = sizeof(float) * DEFAULT_CHANNELS; - n_frames = buf->datas[0].maxsize / stride; + n_frames = SPA_MIN(b->requested, buf->datas[0].maxsize / stride); fill_f32(data, p, n_frames);