alsa: try to recover when mmap_begin fails

In case the get_avail call did not catch the device error, handle the
error and try to recover in the mmap_begin call instead.

See #3315
This commit is contained in:
Wim Taymans 2023-06-27 13:25:47 +02:00
parent 39165a8471
commit b32715ba41

View file

@ -2263,6 +2263,7 @@ again:
if (SPA_UNLIKELY((res = snd_pcm_mmap_begin(hndl, &my_areas, &offset, &frames)) < 0)) {
spa_log_error(state->log, "%s: snd_pcm_mmap_begin error: %s",
state->props.device, snd_strerror(res));
alsa_recover(state, res);
return res;
}
spa_log_trace_fp(state->log, "%p: begin offset:%ld avail:%ld threshold:%d",
@ -2500,6 +2501,7 @@ int spa_alsa_read(struct state *state)
if ((res = snd_pcm_mmap_begin(hndl, &my_areas, &offset, &to_read)) < 0) {
spa_log_error(state->log, "%s: snd_pcm_mmap_begin error: %s",
state->props.device, snd_strerror(res));
alsa_recover(state, res);
return res;
}
spa_log_trace_fp(state->log, "%p: begin offs:%ld frames:%ld to_read:%ld thres:%d", state,