alsa: make sure we recalculate config when samplerate changes

The threshold depends on the samplerate and even when the graph rate or
quantum didn't change, the driver could be opened in a different
samplerate, which would cause the timeouts to be wrong and cause xruns.
This commit is contained in:
Wim Taymans 2023-09-15 11:08:35 +02:00
parent fa7cd96b6e
commit a5d684af8a

View file

@ -1653,6 +1653,11 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
else
state->frame_size *= rchannels;
/* make sure we updates threshold in check_position_config() because they depend
* on the samplerate. */
state->duration = 0;
state->rate_denom = 0;
state->have_format = true;
if (state->card->format_ref++ == 0)
state->card->rate = rrate;