Commit 3e00fa13 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

PulseAudio: improve resampling formula

...for good this time (yeah right).
parent a31dcff4
......@@ -272,9 +272,10 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
sync = true;
/* Compute playback sample rate */
/* This is empirical. Feel free to define something smarter. */
/* This is empirical (especially the shift values).
* Feel free to define something smarter. */
int adj = sync ? (outrate - inrate)
: outrate * (delta + change) / (CLOCK_FREQ << 4);
: outrate * ((delta >> 4) + change) / (CLOCK_FREQ << 2);
/* This avoids too quick rate variation. It sounds really bad and
* causes unstability (e.g. oscillation around the correct rate). */
int limit = inrate >> 10;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment