1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 11:42:04 +00:00

ao_alsa: POLLERR can be set even if the device is not lost

Apparently POLLERR can be set if poll is called while the device is in
the SND_PCM_STATE_PREPARED state. So assume that we can simply call
snd_pcm_status() to check whether the error is because the device went
away (i.e. we expect it to return ENODEV if this happened).

This avoids sporadic device lost warnings and AO reloads. The actual
device lost case is untested.
This commit is contained in:
wm4 2017-03-14 15:43:36 +01:00
parent 636675ece8
commit bc04acf3a7

View File

@ -1125,7 +1125,11 @@ static int audio_wait(struct ao *ao, pthread_mutex_t *lock)
CHECK_ALSA_ERROR("cannot read poll events");
if (revents & POLLERR) {
check_device_present(ao, -ENODEV);
snd_pcm_status_t *status;
snd_pcm_status_alloca(&status);
err = snd_pcm_status(p->alsa, status);
check_device_present(ao, err);
return -1;
}
if (revents & POLLOUT)