diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 35cae353d9..1bf6015c78 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -929,7 +929,7 @@ static bool recover_and_get_state(struct ao *ao, struct mp_pcm_state *state) // Give it a number of chances to recover. This tries to deal with the fact // that the API is asynchronous, and to account for some past cargo-cult // (where things were retried in a loop). - for (int n = 0; n < 10; n++) { + for (int n = 0; n <= 10; n++) { err = snd_pcm_status(p->alsa, st); if (err == -EPIPE) { // ALSA APIs can return -EPIPE when an XRUN happens, @@ -943,6 +943,9 @@ static bool recover_and_get_state(struct ao *ao, struct mp_pcm_state *state) pcmst = snd_pcm_status_get_state(st); } + if (n == 10) + pcmst = SND_PCM_STATE_DISCONNECTED; + if (pcmst == SND_PCM_STATE_PREPARED || pcmst == SND_PCM_STATE_RUNNING || pcmst == SND_PCM_STATE_PAUSED)