On Sun, 2016-06-05 at 21:05 +0200, Georg Chini wrote: > @@ -337,6 +338,8 @@ static void adjust_rates(struct userdata *u) { > Â Â Â Â Â Â Â Â Â u->next_latency_with_drift = current_latency; > Â > Â Â Â Â Â } else { > +Â Â Â Â Â Â Â Â /* Low pass filtered latency error. This value reflects how well the measured values match the prediction. */ > +Â Â Â Â Â Â Â Â u->latency_error = (1 - FILTER_PARAMETER) * u->latency_error + FILTER_PARAMETER * (double)abs((int32_t)(current_latency - u->next_latency_with_drift)); The (int32_t) cast should be applied to the individual terms rather than to the result of the substraction. > Â /* Called from main context */ > @@ -627,6 +634,7 @@ static void source_output_detach_cb(pa_source_output *o) { > Â Â Â Â Â u->iteration_counter = 0; > Â Â Â Â Â u->underrun_counter = 0; > Â Â Â Â Â u->extra_latency = 0; > +Â Â Â Â u->latency_error = 0; u->latency_error should be set from the main thread ... except that the main thread is waiting when detach() is called, so actually this is safe. I may have had some incorrect complaints about those other variables too. --Â Tanu