diff options
author | wm4 <wm4@nowhere> | 2017-03-14 15:43:36 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-03-14 15:50:18 +0100 |
commit | bc04acf3a76eb579ad0012286ac3bfeadaa07cc0 (patch) | |
tree | 7f877fed6e5e2695b26ffe4da5ff9c0a6fe9a155 /audio | |
parent | 636675ece866cf29291622adcccd93799a821d3d (diff) | |
download | mpv-bc04acf3a76eb579ad0012286ac3bfeadaa07cc0.tar.bz2 mpv-bc04acf3a76eb579ad0012286ac3bfeadaa07cc0.tar.xz |
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.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_alsa.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index ced2ed2325..f9d8f9a335 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -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) |