alsa: don't change avail when unchanged

Only update the avail when we did a snd_pcm_forward(). Otherwise
we might think there is more available than there really is and we
might get xrun.

See #3395
This commit is contained in:
Wim Taymans 2023-07-31 12:10:36 +02:00
parent c9b7367f8f
commit fd585baa88

View file

@ -2498,9 +2498,10 @@ int spa_alsa_read(struct state *state)
if (avail < target)
max_read = target - avail;
else if (avail > target)
else if (avail > target) {
snd_pcm_forward(state->hndl, avail - target);
avail = target;
avail = target;
}
state->alsa_sync = false;
} else
state->alsa_sync_warning = true;