Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d27c65d authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Tune the overrun correction

The new overrun correction is: if the previous write() cycle time is <
50% of expected, then sleep enough extra to make the total cycle time =
95% of expected.  This should help compensate for HAL implementations
that have uneven cycle times due to sample rate conversion.

Bug: 6881638
Change-Id: I5ab58afdfceee7ac523177f021fbf62d743d571a
parent e983aa4f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -222,8 +222,8 @@ bool FastMixer::threadLoop()
                    mixBuffer = new short[frameCount * 2];
                    periodNs = (frameCount * 1000000000LL) / sampleRate;    // 1.00
                    underrunNs = (frameCount * 1750000000LL) / sampleRate;  // 1.75
                    overrunNs = (frameCount * 250000000LL) / sampleRate;    // 0.25
                    forceNs = (frameCount * 750000000LL) / sampleRate;      // 0.75
                    overrunNs = (frameCount * 500000000LL) / sampleRate;    // 0.50
                    forceNs = (frameCount * 950000000LL) / sampleRate;      // 0.95
                    warmupNs = (frameCount * 500000000LL) / sampleRate;     // 0.50
                } else {
                    periodNs = 0;