From 8b1d593d3aec9e8a6b85ee52101508034826cf8d Mon Sep 17 00:00:00 2001 From: sletz Date: Wed, 17 Nov 2010 16:26:36 +0000 Subject: [PATCH] ALSA backend : suspend/resume handling (jack1 r4075). git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4088 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 6 +++++- linux/alsa/JackAlsaDriver.cpp | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 179897d0..2bca3450 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,10 +33,14 @@ David Garcia Garzon Jackdmp changes log --------------------------- +2010-11-17 Stephane Letz + + * ALSA backend : suspend/resume handling (jack1 r4075). + 2010-11-05 Stephane Letz * In jackdmp.cpp, jackctl_setup_signals moved before jackctl_server_start. - * Correct symbols export in backends. + * Correct symbols export in backends on OSX. 2010-11-03 Stephane Letz diff --git a/linux/alsa/JackAlsaDriver.cpp b/linux/alsa/JackAlsaDriver.cpp index efcc1f94..8b5512e6 100644 --- a/linux/alsa/JackAlsaDriver.cpp +++ b/linux/alsa/JackAlsaDriver.cpp @@ -1188,6 +1188,19 @@ JackAlsaDriver::alsa_driver_xrun_recovery (alsa_driver_t *driver, float *delayed jack_error("status error: %s", snd_strerror(res)); } } + + if (snd_pcm_status_get_state(status) == SND_PCM_STATE_SUSPENDED) { + jack_error("**** alsa_pcm: pcm in suspended state, resuming it" ); + if (driver->capture_handle) { + if ((res = snd_pcm_prepare(driver->capture_handle)) < 0) { + jack_error("error preparing after suspend: %s", snd_strerror(res)); + } + } else { + if ((res = snd_pcm_prepare(driver->playback_handle)) < 0) { + jack_error("error preparing after suspend: %s", snd_strerror(res)); + } + } + } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN && driver->process_count > XRUN_REPORT_DELAY) {