diff --git a/src/examples/audio-src.c b/src/examples/audio-src.c index f6120b345..22b6a581a 100644 --- a/src/examples/audio-src.c +++ b/src/examples/audio-src.c @@ -73,7 +73,9 @@ static void on_process(void *userdata) return; stride = sizeof(float) * DEFAULT_CHANNELS; - n_frames = SPA_MIN(b->requested, buf->datas[0].maxsize / stride); + n_frames = buf->datas[0].maxsize / stride; + if (b->requested) + n_frames = SPA_MIN((int)b->requested, n_frames); fill_f32(data, p, n_frames); diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index db6d61743..2ed7529fd 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -845,7 +845,8 @@ static void on_process(void *userdata) bool null_frame = false; n_frames = d->maxsize / data->stride; - n_frames = SPA_MIN(n_frames, (int)b->requested); + if (b->requested) + n_frames = SPA_MIN(n_frames, (int)b->requested); /* Note that when playing encoded audio, the encoded_playback_fill() * fill callback actually returns number of bytes, not frames, since