From 2bad67f3e33f74bdd3a8265e9a00a38e4d43e005 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Tue, 6 Mar 2012 11:24:48 -0800 Subject: Rename updateWaitTime since a lock is held Change-Id: I9bb978cbd0debf5b21676467060f72eebafea3e6 --- services/audioflinger/AudioFlinger.cpp | 11 +++++------ services/audioflinger/AudioFlinger.h | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index b97254827521..3b531bcd75e6 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -2067,9 +2067,7 @@ if (mType == MIXER) { maxPeriod = seconds(mFrameCount) / mSampleRate * 15; } -if (mType == DUPLICATING) { - updateWaitTime(); -} + updateWaitTime_l(); activeSleepTime = activeSleepTimeUs(); idleSleepTime = idleSleepTimeUs(); @@ -3202,7 +3200,7 @@ void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread) thread->setStreamVolume(AUDIO_STREAM_CNT, 1.0f); mOutputTracks.add(outputTrack); ALOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread); - updateWaitTime(); + updateWaitTime_l(); } } @@ -3213,14 +3211,15 @@ void AudioFlinger::DuplicatingThread::removeOutputTrack(MixerThread *thread) if (mOutputTracks[i]->thread() == thread) { mOutputTracks[i]->destroy(); mOutputTracks.removeAt(i); - updateWaitTime(); + updateWaitTime_l(); return; } } ALOGV("removeOutputTrack(): unkonwn thread: %p", thread); } -void AudioFlinger::DuplicatingThread::updateWaitTime() +// caller must hold mLock +void AudioFlinger::DuplicatingThread::updateWaitTime_l() { mWaitTimeMs = UINT_MAX; for (size_t i = 0; i < mOutputTracks.size(); i++) { diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index c7ac0a871f1d..28b33a299174 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -812,7 +812,7 @@ protected: virtual void threadLoop_standby(); // Non-trivial for DUPLICATING only - virtual void updateWaitTime() { } + virtual void updateWaitTime_l() { } // Non-trivial for DIRECT only virtual void applyVolume() { } @@ -1046,7 +1046,9 @@ public: virtual void threadLoop_sleepTime(); virtual void threadLoop_write(); virtual void threadLoop_standby(); - virtual void updateWaitTime(); + + // called from threadLoop, addOutputTrack, removeOutputTrack + virtual void updateWaitTime_l(); private: uint32_t mWaitTimeMs; -- cgit v1.2.3-59-g8ed1b