summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-05-15 07:39:52 -0700
committerGlenn Kasten <gkasten@google.com>2012-05-15 17:19:11 -0700
commit9017e5e0ebad9664bb7b6f2057e5bb29c852c64f (patch)
tree7598acfb775b560be2e160057d9f9eec86167c0e /services
parent6d0780ae34ed2fa3e9631667f200e15ddd472464 (diff)
Increase normal mixer's pipe to fast mixer
Change-Id: I330925c7d07b6adb30b773bda3657e4efef9ae9b
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 75e8cca9..93838643 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2203,9 +2203,10 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
// 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);