alsa: try to resync on commit error

When we get a commit error, try to resync our pointers. This fixes a
problem of endless commit errors after a quantum change because it never
manages to resync properly.
This commit is contained in:
Wim Taymans 2022-02-08 18:31:42 +01:00
parent bf886ba209
commit 14d252ec9d

View file

@ -1947,8 +1947,8 @@ again:
state->props.device, snd_strerror(commitres)); state->props.device, snd_strerror(commitres));
if (commitres != -EPIPE && commitres != -ESTRPIPE) if (commitres != -EPIPE && commitres != -ESTRPIPE)
return res; return res;
state->alsa_sync = true;
} }
if (commitres > 0 && written != (snd_pcm_uframes_t) commitres) { if (commitres > 0 && written != (snd_pcm_uframes_t) commitres) {
spa_log_warn(state->log, "%s: mmap_commit wrote %ld instead of %ld", spa_log_warn(state->log, "%s: mmap_commit wrote %ld instead of %ld",
state->props.device, commitres, written); state->props.device, commitres, written);
@ -2133,8 +2133,8 @@ int spa_alsa_read(struct state *state)
state->props.device, snd_strerror(commitres)); state->props.device, snd_strerror(commitres));
if (commitres != -EPIPE && commitres != -ESTRPIPE) if (commitres != -EPIPE && commitres != -ESTRPIPE)
return res; return res;
state->alsa_sync = true;
} }
if (commitres > 0 && read != (snd_pcm_uframes_t) commitres) { if (commitres > 0 && read != (snd_pcm_uframes_t) commitres) {
spa_log_warn(state->log, "%s: mmap_commit read %ld instead of %ld", spa_log_warn(state->log, "%s: mmap_commit read %ld instead of %ld",
state->props.device, commitres, read); state->props.device, commitres, read);