summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-09-15 02:26:19 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-09-15 02:26:19 -0400
commitf5733b2938151fda955f01d9dc3ad15f7292604d (patch)
tree573553d3f03c182e0b70bf0fff4ae2112e6b904c
parentacfb3cf865ea45374acd59337adeafc5941034c8 (diff)
parenta6e58fe31667fab8ccfd01912a5e76e5c6f6d71f (diff)
downloadframeworks_native-f5733b2938151fda955f01d9dc3ad15f7292604d.zip
frameworks_native-f5733b2938151fda955f01d9dc3ad15f7292604d.tar.gz
frameworks_native-f5733b2938151fda955f01d9dc3ad15f7292604d.tar.bz2
Merge change 24872 into eclair
* changes: Fix issue 2115450: a2dp thread is started, even though we are only connected to headset and not playing music.
-rw-r--r--libs/audioflinger/AudioFlinger.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 790a655..d9be007 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -1239,7 +1239,7 @@ bool AudioFlinger::MixerThread::threadLoop()
// active tracks were late. Sleep a little bit to give
// them another chance. If we're too late, write 0s to audio
// hardware to avoid underrun.
- if (sleepTime < kMaxBufferRecoveryInUsecs) {
+ if (mBytesWritten == 0 || sleepTime < kMaxBufferRecoveryInUsecs) {
usleep(kBufferRecoveryInUsecs);
} else {
memset (curBuf, 0, mixBufferSize);
@@ -1741,7 +1741,8 @@ bool AudioFlinger::DirectOutputThread::threadLoop()
standbyTime = systemTime() + kStandbyTimeInNsecs;
} else {
sleepTime += kBufferRecoveryInUsecs;
- if (sleepTime < kMaxBufferRecoveryInUsecs) {
+ if (mBytesWritten == 0 || !AudioSystem::isLinearPCM(mFormat) ||
+ sleepTime < kMaxBufferRecoveryInUsecs) {
usleep(kBufferRecoveryInUsecs);
} else {
memset (mMixBuffer, 0, mFrameCount * mFrameSize);