From deca2ae0a7cf8bc54ff3f30b7dc39bbc78b94c0d Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Fri, 7 Feb 2014 10:25:56 -0800 Subject: Add _l suffix to readInputParameters/OutputParameters They are always called while thread mutex is locked, or in the thread constructor. Change-Id: I56df71563a52a5cd6cea6fc0914df993519e1b74 --- services/audioflinger/RecordTracks.h | 2 +- services/audioflinger/Threads.cpp | 22 +++++++++++----------- services/audioflinger/Threads.h | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'services/audioflinger') diff --git a/services/audioflinger/RecordTracks.h b/services/audioflinger/RecordTracks.h index b40ac2f..13442c1 100644 --- a/services/audioflinger/RecordTracks.h +++ b/services/audioflinger/RecordTracks.h @@ -60,7 +60,7 @@ private: bool mOverflow; // overflow on most recent attempt to fill client buffer - // updated by RecordThread::readInputParameters() + // updated by RecordThread::readInputParameters_l() AudioResampler *mResampler; // interleaved stereo pairs of fixed-point signed Q19.12 diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index fff10fa..32ad8ab 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -274,7 +274,8 @@ AudioFlinger::ThreadBase::ThreadBase(const sp& audioFlinger, audio mType(type), mAudioFlinger(audioFlinger), // mSampleRate, mFrameCount, mChannelMask, mChannelCount, mFrameSize, mFormat, mBufferSize - // are set by PlaybackThread::readOutputParameters() or RecordThread::readInputParameters() + // are set by PlaybackThread::readOutputParameters_l() or + // RecordThread::readInputParameters_l() mParamStatus(NO_ERROR), //FIXME: mStandby should be true here. Is this some kind of hack? mStandby(false), mOutDevice(outDevice), mInDevice(inDevice), @@ -1108,7 +1109,7 @@ AudioFlinger::PlaybackThread::PlaybackThread(const sp& audioFlinge } } - readOutputParameters(); + readOutputParameters_l(); // mStreamTypes[AUDIO_STREAM_CNT] is initialized by stream_type_t default constructor // There is no AUDIO_STREAM_MIN, and ++ operator does not compile @@ -1677,7 +1678,7 @@ int AudioFlinger::PlaybackThread::asyncCallback(stream_callback_event_t event, return 0; } -void AudioFlinger::PlaybackThread::readOutputParameters() +void AudioFlinger::PlaybackThread::readOutputParameters_l() { // unfortunately we have no way of recovering from errors here, hence the LOG_FATAL mSampleRate = mOutput->stream->common.get_sample_rate(&mOutput->stream->common); @@ -1765,7 +1766,7 @@ void AudioFlinger::PlaybackThread::readOutputParameters() // force reconfiguration of effect chains and engines to take new buffer size and audio // parameters into account - // Note that mLock is not held when readOutputParameters() is called from the constructor + // Note that mLock is not held when readOutputParameters_l() is called from the constructor // but in this case nothing is done below as no audio sessions have effect yet so it doesn't // matter. // create a copy of mEffectChains as calling moveEffectChain_l() can reorder some effect chains @@ -3485,7 +3486,7 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l() keyValuePair.string()); } if (status == NO_ERROR && reconfig) { - readOutputParameters(); + readOutputParameters_l(); delete mAudioMixer; mAudioMixer = new AudioMixer(mNormalFrameCount, mSampleRate); for (size_t i = 0; i < mTracks.size() ; i++) { @@ -3827,7 +3828,7 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameters_l() keyValuePair.string()); } if (status == NO_ERROR && reconfig) { - readOutputParameters(); + readOutputParameters_l(); sendIoConfigEvent_l(AudioSystem::OUTPUT_CONFIG_CHANGED); } } @@ -4461,7 +4462,7 @@ AudioFlinger::RecordThread::RecordThread(const sp& audioFlinger, ) : ThreadBase(audioFlinger, id, outDevice, inDevice, RECORD), mInput(input), mActiveTracksGen(0), mRsmpInBuffer(NULL), - // mRsmpInFrames and mRsmpInFramesP2 are set by readInputParameters() + // mRsmpInFrames and mRsmpInFramesP2 are set by readInputParameters_l() mRsmpInRear(0), // FIXME these should be per-track, so this is only the initial track? mReqChannelCount(popcount(channelMask)), @@ -4473,7 +4474,7 @@ AudioFlinger::RecordThread::RecordThread(const sp& audioFlinger, snprintf(mName, kNameLength, "AudioIn_%X", id); mNBLogWriter = audioFlinger->newWriter_l(kLogSize, mName); - readInputParameters(); + readInputParameters_l(); } @@ -5415,7 +5416,7 @@ bool AudioFlinger::RecordThread::checkForNewParameters_l() status = NO_ERROR; } if (status == NO_ERROR) { - readInputParameters(); + readInputParameters_l(); sendIoConfigEvent_l(AudioSystem::INPUT_CONFIG_CHANGED); } } @@ -5467,8 +5468,7 @@ void AudioFlinger::RecordThread::audioConfigChanged_l(int event, int param __unu mAudioFlinger->audioConfigChanged_l(event, mId, param2); } -//FIXME should be renamed to _l -void AudioFlinger::RecordThread::readInputParameters() +void AudioFlinger::RecordThread::readInputParameters_l() { mSampleRate = mInput->stream->common.get_sample_rate(&mInput->stream->common); mChannelMask = mInput->stream->common.get_channels(&mInput->stream->common); diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index 8d9f3e1..904c292 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -270,8 +270,8 @@ protected: const sp mAudioFlinger; - // updated by PlaybackThread::readOutputParameters() or - // RecordThread::readInputParameters() + // updated by PlaybackThread::readOutputParameters_l() or + // RecordThread::readInputParameters_l() uint32_t mSampleRate; size_t mFrameCount; // output HAL, direct output, record audio_channel_mask_t mChannelMask; @@ -478,7 +478,7 @@ public: status_t getTimestamp_l(AudioTimestamp& timestamp); protected: - // updated by readOutputParameters() + // updated by readOutputParameters_l() size_t mNormalFrameCount; // normal mixer and effects int16_t* mMixBuffer; // frame size aligned mix buffer @@ -541,7 +541,7 @@ private: void removeTrack_l(const sp& track); void broadcast_l(); - void readOutputParameters(); + void readOutputParameters_l(); virtual void dumpInternals(int fd, const Vector& args); void dumpTracks(int fd, const Vector& args); @@ -915,7 +915,7 @@ public: virtual bool checkForNewParameters_l(); virtual String8 getParameters(const String8& keys); virtual void audioConfigChanged_l(int event, int param = 0); - void readInputParameters(); + void readInputParameters_l(); virtual uint32_t getInputFramesLost(); virtual status_t addEffectChain_l(const sp& chain); -- cgit v1.1