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...
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;
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.