aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorJeffrey Middleton <jefromi@gmail.com>2009-11-02 23:52:13 -0600
committerJeffrey Middleton <jefromi@gmail.com>2009-11-02 23:58:15 -0600
commit4dc25d3908648cc781fe43e54243bb64aec4b2cb (patch)
treefb4356a477026ef0860ecef355325e92b13ce8b3 /src/output
parent0f9f82f2275924b6ad2e8f8a9df32494226d96e6 (diff)
downloadmpd-4dc25d3908648cc781fe43e54243bb64aec4b2cb.tar.gz
mpd-4dc25d3908648cc781fe43e54243bb64aec4b2cb.tar.xz
mpd-4dc25d3908648cc781fe43e54243bb64aec4b2cb.zip
alsa_plugin.c: workaround snd_pcm_drain bug
Reintroduce a fix from commit 52a0653 (Warren Dukes): "don't call snd_pcm_drain unless we're already in the RUNNING state". This prevents ALSA with dmix from sometimes hanging when snd_pcm_drain is called, e.g. when moving from one song to the next (as in mantis issue 2634).
Diffstat (limited to 'src/output')
-rw-r--r--src/output/alsa_plugin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index 870115998..48a40fb9b 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -500,7 +500,8 @@ alsa_drain(void *data)
{
struct alsa_data *ad = data;
- snd_pcm_drain(ad->pcm);
+ if (snd_pcm_state(ad->pcm) == SND_PCM_STATE_RUNNING)
+ snd_pcm_drain(ad->pcm);
}
static void