summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-11-26 05:31:01 -0800
committerSteve Kondik <shade@chemlab.org>2015-11-27 05:47:04 -0800
commit3f54b2b7dcdfec8870565588b5e63e93dc5b363d (patch)
tree756b0691ef46d13b6e08657392a5828778ac6423 /services/audioflinger
parent5183735fba449d7a4e305384d78a6c21d406b3bf (diff)
downloadframeworks_av-3f54b2b7dcdfec8870565588b5e63e93dc5b363d.zip
frameworks_av-3f54b2b7dcdfec8870565588b5e63e93dc5b363d.tar.gz
frameworks_av-3f54b2b7dcdfec8870565588b5e63e93dc5b363d.tar.bz2
audioflinger: Adjust throttle interval when effects in use
* Loud clicks/pops are heard when playing to a USB device with AudioFX enabled. Particularly frequent when the USB device is capable of high-resolution output. * Adjust the throttling period when effects are enabled to prevent this. Change-Id: I3db220d13c37f4ff5b835c14831fbe6f5a5b062c
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/Threads.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index d70e457..4cb88c2 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2990,8 +2990,9 @@ bool AudioFlinger::PlaybackThread::threadLoop()
// the app won't fill fast enough to handle the sudden draw).
const int32_t deltaMs = delta / 1000000;
- const int32_t throttleMs = mHalfBufferMs - deltaMs;
- if ((signed)mHalfBufferMs >= throttleMs && throttleMs > 0) {
+ const int32_t halfBufferMs = mHalfBufferMs / (mEffectBufferValid ? 4 : 1);
+ const int32_t throttleMs = halfBufferMs - deltaMs;
+ if ((signed)halfBufferMs >= throttleMs && throttleMs > 0) {
usleep(throttleMs * 1000);
// notify of throttle start on verbose log
ALOGV_IF(mThreadThrottleEndMs == mThreadThrottleTimeMs,