Skip to content

Commit ed4271e

Browse files
gkastenAndroid (Google) Code Review
authored andcommitted
Merge "Add comments about sequence for setting parameters"
2 parents 42f23b3 + bf10657 commit ed4271e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

services/audioflinger/AudioFlinger.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,17 +534,41 @@ class AudioFlinger :
534534
friend class RecordTrack;
535535

536536
const type_t mType;
537+
538+
// Used by parameters, config events, addTrack_l, exit
537539
Condition mWaitWorkCV;
540+
538541
const sp<AudioFlinger> mAudioFlinger;
539542
uint32_t mSampleRate;
540543
size_t mFrameCount;
541544
uint32_t mChannelMask;
542545
uint16_t mChannelCount;
543546
size_t mFrameSize;
544547
audio_format_t mFormat;
548+
549+
// Parameter sequence by client: binder thread calling setParameters():
550+
// 1. Lock mLock
551+
// 2. Append to mNewParameters
552+
// 3. mWaitWorkCV.signal
553+
// 4. mParamCond.waitRelative with timeout
554+
// 5. read mParamStatus
555+
// 6. mWaitWorkCV.signal
556+
// 7. Unlock
557+
//
558+
// Parameter sequence by server: threadLoop calling checkForNewParameters_l():
559+
// 1. Lock mLock
560+
// 2. If there is an entry in mNewParameters proceed ...
561+
// 2. Read first entry in mNewParameters
562+
// 3. Process
563+
// 4. Remove first entry from mNewParameters
564+
// 5. Set mParamStatus
565+
// 6. mParamCond.signal
566+
// 7. mWaitWorkCV.wait with timeout (this is to avoid overwriting mParamStatus)
567+
// 8. Unlock
545568
Condition mParamCond;
546569
Vector<String8> mNewParameters;
547570
status_t mParamStatus;
571+
548572
Vector<ConfigEvent> mConfigEvents;
549573
bool mStandby;
550574
const audio_io_handle_t mId;

0 commit comments

Comments
 (0)