From: Mike Brady Date: Sat, 2 Apr 2016 20:32:44 +0000 (+0000) Subject: Brown bag commit -- not printing delay error messages properly. X-Git-Tag: 2.9.5.7~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca5526ce85a6813c4d4acf684b0aed932c6e63d8;p=thirdparty%2Fshairport-sync.git Brown bag commit -- not printing delay error messages properly. --- diff --git a/audio_alsa.c b/audio_alsa.c index 9e9f8eb6..6c8b3605 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -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) diff --git a/player.c b/player.c index 21fe9670..1de616b2 100644 --- 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); } }