]> git.sesse.net Git - nageru/commitdiff
Fix an issue where we'd count jitter history from the wrong side.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 10 Nov 2017 17:23:26 +0000 (18:23 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 10 Nov 2017 17:23:26 +0000 (18:23 +0100)
Would not only give horribly wrong results, but also consume tons
of CPU power.

mixer.cpp

index dc178db3266f0ee3e97f657930c1b0d0510bfe25..4deba02ac52e97554257bbb109684451a3de6ea9 100644 (file)
--- 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;
        }
 }