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

Commit ce063a35 authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am 54c06152: Merge change 24872 into eclair

Merge commit '54c06152' into eclair-plus-aosp

* commit '54c06152':
  Fix issue 2115450: a2dp thread is started, even though we are only connected to headset and not playing music.
parents 1c3d36ec 54c06152
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);