]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Strengthen the ability to recover from an XRUN by putting in a call to snd_pcm_prepar...
authorMike Brady <mikebrady@eircom.net>
Thu, 3 Jan 2019 10:19:44 +0000 (10:19 +0000)
committerMike Brady <mikebrady@eircom.net>
Thu, 3 Jan 2019 10:19:44 +0000 (10:19 +0000)
audio_alsa.c

index 26aac7b00d820f48ecb75d90c27a129a1c8449a2..43e267498d0577c8fd166ad2a352f51504fbc92d 100644 (file)
@@ -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)