[pulseaudio-discuss] [PATCH v6 21/25] loopback: Track prediction error; debug and cosmetic changes

Tanu Kaskinen tanuk at iki.fi
Wed Aug 24 19:52:10 UTC 2016


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


More information about the pulseaudio-discuss mailing list