diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-05-12 22:25:24 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-05-12 22:25:24 +0200 |
commit | 712683998c59bdab7a72ec6acd0b7eb936d79878 (patch) | |
tree | fca729f6c004aa6aa2a2b0d471f77c91c8831c29 /plugins/alsa | |
parent | 367a5c0d4b265f27af4e6eeed708e6583d97381a (diff) |
fixed recover from suspend bug #3000300
Diffstat (limited to 'plugins/alsa')
-rw-r--r-- | plugins/alsa/alsa.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index bcf03ad8..59de8d2b 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -506,8 +506,18 @@ palsa_thread (void *context) { if (err < 0) { if (err == -ESTRPIPE) { fprintf (stderr, "alsa: trying to recover from suspend... (error=%d, %s)\n", err, snd_strerror (err)); - deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0); - break; + while ((err = snd_pcm_resume(audio)) == -EAGAIN) { + sleep(1); /* wait until the suspend flag is released */ + } + if (err < 0) { + err = snd_pcm_prepare(audio); + if (err < 0) { + fprintf (stderr, "Can't recovery from suspend, prepare failed: %s", snd_strerror(err)); + exit (-1); + } + } + // deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0); + // break; } else { if (err != -EPIPE) { |