Commit 8e2b5d8d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

PulseAudio: improve resampling formula

...for good this time (yeah right).
(cherry picked from commit 3e00fa130e30266dcb6b6ae75384ae69d46f50f3)
parent 0d5a7d4b
......@@ -215,9 +215,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