From: Mike Brady Date: Wed, 22 Aug 2018 13:41:03 +0000 (+0100) Subject: Bring up to date with 3.3d2 from the raspberry pi X-Git-Tag: 3.3RC0~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f6a446e1b517ab5b7dc03341bc271d36771768;p=thirdparty%2Fshairport-sync.git Bring up to date with 3.3d2 from the raspberry pi --- d2f6a446e1b517ab5b7dc03341bc271d36771768 diff --cc audio_alsa.c index ea6ab91f,cee43e9d..1abc2961 --- a/audio_alsa.c +++ b/audio_alsa.c @@@ -882,8 -882,12 +882,14 @@@ int delay(long *the_delay) debug(1, "Error %d in delay(): \"%s\". Delay reported is %d frames.", reply, snd_strerror(reply), *the_delay); snd_pcm_recover(alsa_handle, reply, 1); + frame_index = 0; + measurement_data_is_valid = 0; + } else { + if (*the_delay == 0) { + // there's nothing in the pipeline, so we can't measure frame rate. + frame_index = 0; // we'll be starting over... + measurement_data_is_valid = 0; + } } } else { frame_index = 0; // we'll be starting over... @@@ -985,10 -989,17 +991,17 @@@ static int play(void *buf, int samples debug(1, "Error %d in delay(): \"%s\". Delay reported is %d frames.", err2, snd_strerror(err2), fl); snd_pcm_recover(alsa_handle, err2, 1); + frame_index = 0; + measurement_data_is_valid = 0; + } else { + if (fl == 0) { + // there's nothing in the pipeline, so we can't measure frame rate. + frame_index = 0; // we'll be starting over... + measurement_data_is_valid = 0; + } } - measurement_time = get_absolute_time_in_fp(); + + uint64_t tf = get_absolute_time_in_fp(); frames_played_at_measurement_time = frames_sent_for_playing - fl; if (frame_index == start_measurement_from_this_frame) { frames_played_at_measurement_start_time = frames_played_at_measurement_time; diff --cc dacp.c index 81e7b530,81e7b530..31497915 --- a/dacp.c +++ b/dacp.c @@@ -277,7 -277,7 +277,7 @@@ int dacp_send_command(const char *comma } if (http_iserror(&rt)) { -- debug(1, "Error parsing data."); ++ debug(3, "Error parsing data."); free(response.body); response.body = NULL; response.malloced_size = 0; diff --cc player.c index 3c2a1c28,bdc5ffe1..3f3fa505 --- a/player.c +++ b/player.c @@@ -2096,10 -2107,13 +2107,20 @@@ void *player_thread_func(void *arg) int64_t should_be_frame; local_time_to_frame(local_time_now, &should_be_frame, conn); ++<<<<<<< HEAD + //if (abs(td_in_frames + rt - should_be_frame) > 10 * conn->output_sample_ratio) + // debug(1, "Difference between old and new frame number is %" PRId64 " frames.", + // td_in_frames + rt - should_be_frame); + ++======= + int64_t absolute_difference_in_frames = td_in_frames + rt - should_be_frame; + if (absolute_difference_in_frames < 0) + absolute_difference_in_frames = -absolute_difference_in_frames; + + if (absolute_difference_in_frames > 10 * conn->output_sample_ratio) + debug(1, "Difference between old and new frame number is %" PRId64 " frames.", + td_in_frames + rt - should_be_frame); ++>>>>>>> 347e63ba906e80bfc01596bacfbd18fbe0b6f940 // this is the actual delay, including the latency we actually want, which will // fluctuate a good bit about a potentially rising or falling trend.