diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-07-16 16:52:29 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2006-07-16 16:52:29 +0000 |
commit | 6b2167a4440f2c8b3f138b2a3df26310edb41d5a (patch) | |
tree | 3e494613827a7f821fe0055b297ba06997c950e9 /src/audioOutputs | |
parent | 8224e837ef60278a9a1140515d79650d9024757e (diff) | |
download | mpd-6b2167a4440f2c8b3f138b2a3df26310edb41d5a.tar.gz mpd-6b2167a4440f2c8b3f138b2a3df26310edb41d5a.tar.xz mpd-6b2167a4440f2c8b3f138b2a3df26310edb41d5a.zip |
audio: attempt to gracefully handle disconnected/reconnected devices
Currently only ALSA is supported/tested, and only if the mixer
device is not on the audio device being disconnected (software
mixer).
This patch allows me to disconnect my Headroom Total Airhead USB
sound card, and resume playback (skips to the next song, which
should be fixed) when the device is plugged back in.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4364 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/audioOutputs/audioOutput_alsa.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c index bc727c556..3abd81f31 100644 --- a/src/audioOutputs/audioOutput_alsa.c +++ b/src/audioOutputs/audioOutput_alsa.c @@ -315,6 +315,11 @@ static int alsa_errorRecovery(AlsaData * ad, int err) { case SND_PCM_STATE_XRUN: err = snd_pcm_prepare(ad->pcmHandle); break; + case SND_PCM_STATE_DISCONNECTED: + /* so alsa_closeDevice won't try to drain: */ + snd_pcm_close(ad->pcmHandle); + ad->pcmHandle = NULL; + break; default: /* unknown state, do nothing */ break; |