From cbc52bfb3b51c81c945b1e35990324bde892829a Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Thu, 1 Mar 2012 09:21:37 -0800 Subject: [PATCH] Add comments about sequence for setting parameters Change-Id: Iffa59a34c3c47bdc1d3234cdcb4d8ff99c102825 --- services/audioflinger/AudioFlinger.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 28b33a2991..60d78c8999 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -534,7 +534,10 @@ private: friend class RecordTrack; const type_t mType; + + // Used by parameters, config events, addTrack_l, exit Condition mWaitWorkCV; + const sp mAudioFlinger; uint32_t mSampleRate; size_t mFrameCount; @@ -542,9 +545,30 @@ private: uint16_t mChannelCount; size_t mFrameSize; audio_format_t mFormat; + + // Parameter sequence by client: binder thread calling setParameters(): + // 1. Lock mLock + // 2. Append to mNewParameters + // 3. mWaitWorkCV.signal + // 4. mParamCond.waitRelative with timeout + // 5. read mParamStatus + // 6. mWaitWorkCV.signal + // 7. Unlock + // + // Parameter sequence by server: threadLoop calling checkForNewParameters_l(): + // 1. Lock mLock + // 2. If there is an entry in mNewParameters proceed ... + // 2. Read first entry in mNewParameters + // 3. Process + // 4. Remove first entry from mNewParameters + // 5. Set mParamStatus + // 6. mParamCond.signal + // 7. mWaitWorkCV.wait with timeout (this is to avoid overwriting mParamStatus) + // 8. Unlock Condition mParamCond; Vector mNewParameters; status_t mParamStatus; + Vector mConfigEvents; bool mStandby; const audio_io_handle_t mId; -- 2.11.0