From: Mike Brady Date: Thu, 3 Jan 2019 10:19:44 +0000 (+0000) Subject: Strengthen the ability to recover from an XRUN by putting in a call to snd_pcm_prepar... X-Git-Tag: 3.3RC0~66^2~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41c8c8b9a166941d75fa3d88bcf348b68c6698cb;p=thirdparty%2Fshairport-sync.git Strengthen the ability to recover from an XRUN by putting in a call to snd_pcm_prepare first. --- diff --git a/audio_alsa.c b/audio_alsa.c index 26aac7b0..43e26749 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -1021,8 +1021,10 @@ int delay_prep_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay) { *state = snd_pcm_status_get_state(alsa_snd_pcm_status); if ((*state == SND_PCM_STATE_SUSPENDED) || (*state == SND_PCM_STATE_XRUN)) { - debug(1, "alsa: recovering from suspended or xrun in delay."); - ret = snd_pcm_recover(alsa_handle, ret, 1); + debug(1, "alsa: recovering from SND_PCM_STATE_* %d in delay_prep_and_status.", *state); + ret = snd_pcm_prepare(alsa_handle); + if (ret == 0) + ret = snd_pcm_recover(alsa_handle, ret, 1); if (ret == 0) { ret = snd_pcm_status(alsa_handle, alsa_snd_pcm_status); if (ret == 0)