From: Steinar H. Gunderson Date: Fri, 10 Nov 2017 17:23:26 +0000 (+0100) Subject: Fix an issue where we'd count jitter history from the wrong side. X-Git-Tag: 1.6.4~2 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=14f5c097303807fa9f63560089f3d96fc330121f Fix an issue where we'd count jitter history from the wrong side. Would not only give horribly wrong results, but also consume tons of CPU power. --- diff --git a/mixer.cpp b/mixer.cpp index dc178db..4deba02 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -239,7 +239,7 @@ double JitterHistory::estimate_max_jitter() const if (percentile <= 0.5) { return *next(orders.begin(), elem_idx) * multiplier; } else { - return *prev(orders.end(), elem_idx + 1) * multiplier; + return *prev(orders.end(), orders.size() - elem_idx) * multiplier; } }