Skip to content

Commit dbaf2cc

Browse files
gkastenAndroid (Google) Code Review
authored andcommitted
Merge "Rename updateWaitTime since a lock is held"
2 parents 75d022a + 2bad67f commit dbaf2cc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

services/audioflinger/AudioFlinger.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,9 +2067,7 @@ if (mType == MIXER) {
20672067
maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
20682068
}
20692069

2070-
if (mType == DUPLICATING) {
2071-
updateWaitTime();
2072-
}
2070+
updateWaitTime_l();
20732071

20742072
activeSleepTime = activeSleepTimeUs();
20752073
idleSleepTime = idleSleepTimeUs();
@@ -3202,7 +3200,7 @@ void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread)
32023200
thread->setStreamVolume(AUDIO_STREAM_CNT, 1.0f);
32033201
mOutputTracks.add(outputTrack);
32043202
ALOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
3205-
updateWaitTime();
3203+
updateWaitTime_l();
32063204
}
32073205
}
32083206

@@ -3213,14 +3211,15 @@ void AudioFlinger::DuplicatingThread::removeOutputTrack(MixerThread *thread)
32133211
if (mOutputTracks[i]->thread() == thread) {
32143212
mOutputTracks[i]->destroy();
32153213
mOutputTracks.removeAt(i);
3216-
updateWaitTime();
3214+
updateWaitTime_l();
32173215
return;
32183216
}
32193217
}
32203218
ALOGV("removeOutputTrack(): unkonwn thread: %p", thread);
32213219
}
32223220

3223-
void AudioFlinger::DuplicatingThread::updateWaitTime()
3221+
// caller must hold mLock
3222+
void AudioFlinger::DuplicatingThread::updateWaitTime_l()
32243223
{
32253224
mWaitTimeMs = UINT_MAX;
32263225
for (size_t i = 0; i < mOutputTracks.size(); i++) {

services/audioflinger/AudioFlinger.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ class AudioFlinger :
812812
virtual void threadLoop_standby();
813813

814814
// Non-trivial for DUPLICATING only
815-
virtual void updateWaitTime() { }
815+
virtual void updateWaitTime_l() { }
816816

817817
// Non-trivial for DIRECT only
818818
virtual void applyVolume() { }
@@ -1046,7 +1046,9 @@ class AudioFlinger :
10461046
virtual void threadLoop_sleepTime();
10471047
virtual void threadLoop_write();
10481048
virtual void threadLoop_standby();
1049-
virtual void updateWaitTime();
1049+
1050+
// called from threadLoop, addOutputTrack, removeOutputTrack
1051+
virtual void updateWaitTime_l();
10501052
private:
10511053

10521054
uint32_t mWaitTimeMs;

0 commit comments

Comments
 (0)