From 68fa9667ecdc0c23aaa8b346930aeca983045df2 Mon Sep 17 00:00:00 2001 From: ranma Date: Sat, 4 Oct 2008 15:03:10 +0000 Subject: [PATCH] Make alsa resume after suspend to disk (would say 'file descriptor is in bad state' before this change) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27712 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_alsa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 987713e6f9..e5372390f8 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -765,6 +765,10 @@ static void audio_resume(void) { int err; + if (snd_pcm_state(alsa_handler) == SND_PCM_STATE_SUSPENDED) { + mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_PcmInSuspendModeTryingResume); + while ((err = snd_pcm_resume(alsa_handler)) == -EAGAIN) sleep(1); + } if (alsa_can_pause) { if ((err = snd_pcm_pause(alsa_handler, 0)) < 0) {