]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Brown bag commit -- not printing delay error messages properly.
authorMike Brady <mikebrady@eircom.net>
Sat, 2 Apr 2016 20:32:44 +0000 (20:32 +0000)
committerMike Brady <mikebrady@eircom.net>
Sat, 2 Apr 2016 20:32:44 +0000 (20:32 +0000)
audio_alsa.c
player.c

index 9e9f8eb65706178736f3d8015a056db379e43774..6c8b3605938748ed5e5295e63d1eeafdbbc1509a 100644 (file)
@@ -607,11 +607,12 @@ int delay(long* the_delay) {
     pthread_mutex_lock(&alsa_mutex);
     int derr, ignore;
     if (snd_pcm_state(alsa_handle) == SND_PCM_STATE_RUNNING) {
+      *the_delay = 0; // just to see what happens
       reply = snd_pcm_delay(alsa_handle, the_delay);
       if (reply != 0) {
-        debug(1, "Error %d in delay(): %s. Delay reported is %d frames.", derr,
-              snd_strerror(derr), *the_delay);
-        ignore = snd_pcm_recover(alsa_handle, derr, 0);
+        debug(1, "Error %d in delay(): \"%s\". Delay reported is %d frames.", reply,
+              snd_strerror(reply), *the_delay);
+        ignore = snd_pcm_recover(alsa_handle, reply, 1);
       }
     } else if (snd_pcm_state(alsa_handle) == SND_PCM_STATE_PREPARED) {
       *the_delay = 0;
@@ -626,8 +627,8 @@ int delay(long* the_delay) {
               snd_pcm_state(alsa_handle));
       }
       if ((derr = snd_pcm_prepare(alsa_handle))) {
-        ignore = snd_pcm_recover(alsa_handle, derr, 0);
-        debug(1, "Error preparing after delay error: %s.", snd_strerror(derr));
+        ignore = snd_pcm_recover(alsa_handle, derr, 1);
+        debug(1, "Error preparing after delay error: \"%s\".", snd_strerror(derr));
       }
     }
     pthread_mutex_unlock(&alsa_mutex);
@@ -657,16 +658,16 @@ static void play(short buf[], int samples) {
         (snd_pcm_state(alsa_handle) == SND_PCM_STATE_RUNNING)) {
       err = snd_pcm_writei(alsa_handle, (char *)buf, samples);
       if (err < 0) {
-        debug(1, "Error %d writing %d samples in play() %s.", err, samples,
+        debug(1, "Error %d writing %d samples in play(): \"%s\".", err, samples,
               snd_strerror(err));
-        ignore = snd_pcm_recover(alsa_handle, err, 0);
+        ignore = snd_pcm_recover(alsa_handle, err, 1);
       }
     } else {
       debug(1, "Error -- ALSA device in incorrect state (%d) for play.",
             snd_pcm_state(alsa_handle));
       if ((err = snd_pcm_prepare(alsa_handle))) {
-        ignore = snd_pcm_recover(alsa_handle, err, 0);
-        debug(1, "Error preparing after play error: %s.", snd_strerror(err));
+        ignore = snd_pcm_recover(alsa_handle, err, 1);
+        debug(1, "Error preparing after play error: \"%s\".", snd_strerror(err));
       }
     }
     pthread_mutex_unlock(&alsa_mutex);
@@ -684,10 +685,10 @@ static void flush(void) {
   if (alsa_handle) {
     // debug(1,"Dropping frames for flush...");
     if ((derr = snd_pcm_drop(alsa_handle)))
-      debug(1, "Error dropping frames: %s.", snd_strerror(derr));
+      debug(1, "Error dropping frames: \"%s\".", snd_strerror(derr));
     // debug(1,"Dropped frames ok. State is %d.",snd_pcm_state(alsa_handle));
     if ((derr = snd_pcm_prepare(alsa_handle)))
-      debug(1, "Error preparing after flush: %s.", snd_strerror(derr));
+      debug(1, "Error preparing after flush: \"%s\".", snd_strerror(derr));
     // debug(1,"Frames successfully dropped.");
     /*
     if (snd_pcm_state(alsa_handle)==SND_PCM_STATE_PREPARED)
index 21fe9670db060dd0c0026791f064afb6b052001c..1de616b285d22b4ee7b83cd861343ac6c9aad437 100644 (file)
--- a/player.c
+++ b/player.c
@@ -1087,7 +1087,7 @@ static void *player_thread_func(void *arg) {
                                                                minimum_dac_queue_size = current_delay; // update for display later
                                                        }
                                                } else { 
-                                                       debug(1, "Delay error %d when checking running latency.",resp);
+                                                       debug(2, "Delay error %d when checking running latency.",resp);
                                                }
                                        }