1
Fork 0

stream: check requested before use

It can be 0 and so we should fill the complete buffer.

Fixes #3683
This commit is contained in:
Wim Taymans 2023-11-30 11:10:47 +01:00
parent 0a7f8128a3
commit 94f898ddc5
2 changed files with 5 additions and 2 deletions

View File

@ -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);

View File

@ -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