aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-07 16:41:39 -0700
committerEric Wong <normalperson@yhbt.net>2008-09-07 16:41:39 -0700
commitbc44454d2b249d80275107dcfca41a20afb48ba9 (patch)
treef043a0cb9322062cefe12f0a49a8eb19b5e6d454 /src
parentb58171db52cc8e22785c3d9c7ae03649497cabc3 (diff)
downloadmpd-bc44454d2b249d80275107dcfca41a20afb48ba9.tar.gz
mpd-bc44454d2b249d80275107dcfca41a20afb48ba9.tar.xz
mpd-bc44454d2b249d80275107dcfca41a20afb48ba9.zip
alsa: extra debugging outputs to fix suspend/hibernate
Hibernating my laptop while MPD is playing results in ugliness about "alsa device foo was suspend" constantly printed to the logs.
Diffstat (limited to '')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index 474db080f..890049779 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -307,13 +307,15 @@ fail:
static int alsa_errorRecovery(AlsaData * ad, int err)
{
+ snd_pcm_state_t state;
+
if (err == -EPIPE) {
DEBUG("Underrun on alsa device \"%s\"\n", ad->device);
} else if (err == -ESTRPIPE) {
DEBUG("alsa device \"%s\" was suspended\n", ad->device);
}
- switch (snd_pcm_state(ad->pcmHandle)) {
+ switch (state = snd_pcm_state(ad->pcmHandle)) {
case SND_PCM_STATE_PAUSED:
err = snd_pcm_pause(ad->pcmHandle, /* disable */ 0);
break;
@@ -333,10 +335,14 @@ static int alsa_errorRecovery(AlsaData * ad, int err)
break;
/* this is no error, so just keep running */
case SND_PCM_STATE_RUNNING:
- err = 0;
+ if (mpd_unlikely(err)) {
+ DEBUG("ALSA: ignoring possible error: %s\n",
+ snd_strerror(-err));
+ err = 0;
+ }
break;
default:
- /* unknown state, do nothing */
+ DEBUG("ALSA in unknown state: %s\n", snd_pcm_state_name(state));
break;
}