alsa: limit headroom to buffer-size

We can never have more headroom that the total buffer-size so better
clamp this here.
This commit is contained in:
Wim Taymans 2021-03-29 13:17:01 +02:00
parent 30659c5f61
commit fda565864c

View file

@ -627,6 +627,8 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
if (is_batch)
state->headroom += period_size;
state->headroom = SPA_MIN(state->headroom, state->buffer_frames);
state->period_frames = period_size;
periods = state->buffer_frames / state->period_frames;