Fix uninitialized field EffectModule::mPinned
Also mark EffectModule::mId and EffectModule::mSessionId const, and
document the initialization of other fields in EffectModule.
Change-Id: Ic1ca008e75e9b5924743ffc35bef80057f3a0669
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index f410a6f..540c9a3 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -7992,8 +7992,15 @@
effect_descriptor_t *desc,
int id,
int sessionId)
- : mThread(thread), mChain(chain), mId(id), mSessionId(sessionId), mEffectInterface(NULL),
- mStatus(NO_INIT), mState(IDLE), mSuspended(false)
+ : mPinned(sessionId > AUDIO_SESSION_OUTPUT_MIX),
+ mThread(thread), mChain(chain), mId(id), mSessionId(sessionId),
+ // mDescriptor is set below
+ // mConfig is set by configure() and not used before then
+ mEffectInterface(NULL),
+ mStatus(NO_INIT), mState(IDLE),
+ // mMaxDisableWaitCnt is set by configure() and not used before then
+ // mDisableWaitCnt is set by process() and updateState() and not used before then
+ mSuspended(false)
{
ALOGV("Constructor %p", this);
int lStatus;
@@ -8015,9 +8022,6 @@
goto Error;
}
- if (mSessionId > AUDIO_SESSION_OUTPUT_MIX) {
- mPinned = true;
- }
ALOGV("Constructor success name %s, Interface %p", mDescriptor.name, mEffectInterface);
return;
Error:
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 22088b0..1993860 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1560,8 +1560,8 @@
mutable Mutex mLock; // mutex for process, commands and handles list protection
wp<ThreadBase> mThread; // parent thread
wp<EffectChain> mChain; // parent effect chain
- int mId; // this instance unique ID
- int mSessionId; // audio session ID
+ const int mId; // this instance unique ID
+ const int mSessionId; // audio session ID
effect_descriptor_t mDescriptor;// effect descriptor received from effect engine
effect_config_t mConfig; // input and output audio configuration
effect_handle_t mEffectInterface; // Effect module C API