Increase normal mixer's pipe to fast mixer
Change-Id: I330925c7d07b6adb30b773bda3657e4efef9ae9b
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 75e8cca..9383864 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2203,9 +2203,10 @@
// create a MonoPipe to connect our submix to FastMixer
NBAIO_Format format = mOutputSink->format();
- // frame count will be rounded up to a power of 2, so this formula should work well
- MonoPipe *monoPipe = new MonoPipe((mNormalFrameCount * 3) / 2, format,
- true /*writeCanBlock*/);
+ // This pipe depth compensates for scheduling latency of the normal mixer thread.
+ // When it wakes up after a maximum latency, it runs a few cycles quickly before
+ // finally blocking. Note the pipe implementation rounds up the request to a power of 2.
+ MonoPipe *monoPipe = new MonoPipe(mNormalFrameCount * 4, format, true /*writeCanBlock*/);
const NBAIO_Format offers[1] = {format};
size_t numCounterOffers = 0;
ssize_t index = monoPipe->negotiate(offers, 1, NULL, numCounterOffers);