Loading services/audioflinger/Effects.cpp +16 −10 Original line number Diff line number Diff line Loading @@ -465,9 +465,9 @@ status_t AudioFlinger::EffectModule::start_l() if (status == 0) { status = cmdStatus; } if (status == 0 && ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC || (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC)) { if (status == 0) { if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC || (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) { sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { audio_stream_t *stream = thread->stream(); Loading @@ -476,6 +476,11 @@ status_t AudioFlinger::EffectModule::start_l() } } } sp<EffectChain> chain = mChain.promote(); if (chain != 0) { chain->forceVolume(); } } return status; } Loading Loading @@ -1326,7 +1331,7 @@ AudioFlinger::EffectChain::EffectChain(ThreadBase *thread, int sessionId) : mThread(thread), mSessionId(sessionId), mActiveTrackCnt(0), mTrackCnt(0), mTailBufferCount(0), mOwnInBuffer(false), mVolumeCtrlIdx(-1), mLeftVolume(UINT_MAX), mRightVolume(UINT_MAX), mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX) mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX), mForceVolume(false) { mStrategy = AudioSystem::getStrategyForStream(AUDIO_STREAM_MUSIC); if (thread == NULL) { Loading Loading @@ -1649,7 +1654,8 @@ bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right) } } if (ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) { if (!isVolumeForced() && ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) { if (hasControl) { *left = mNewLeftVolume; *right = mNewRightVolume; Loading services/audioflinger/Effects.h +7 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,12 @@ public: // At least one non offloadable effect in the chain is enabled bool isNonOffloadableEnabled(); // use release_cas because we don't care about the observed value, just want to make sure the // new value is observable. void forceVolume() { android_atomic_release_cas(false, true, &mForceVolume); } // use acquire_cas because we are interested in the observed value and // we are the only observers. bool isVolumeForced() { return (android_atomic_acquire_cas(true, false, &mForceVolume) == 0); } void dump(int fd, const Vector<String16>& args); Loading Loading @@ -375,4 +381,5 @@ protected: // timeLow fields among effect type UUIDs. // Updated by updateSuspendedSessions_l() only. KeyedVector< int, sp<SuspendedEffectDesc> > mSuspendedEffects; volatile int32_t mForceVolume; // force next volume command because a new effect was enabled }; Loading
services/audioflinger/Effects.cpp +16 −10 Original line number Diff line number Diff line Loading @@ -465,9 +465,9 @@ status_t AudioFlinger::EffectModule::start_l() if (status == 0) { status = cmdStatus; } if (status == 0 && ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC || (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC)) { if (status == 0) { if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC || (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) { sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { audio_stream_t *stream = thread->stream(); Loading @@ -476,6 +476,11 @@ status_t AudioFlinger::EffectModule::start_l() } } } sp<EffectChain> chain = mChain.promote(); if (chain != 0) { chain->forceVolume(); } } return status; } Loading Loading @@ -1326,7 +1331,7 @@ AudioFlinger::EffectChain::EffectChain(ThreadBase *thread, int sessionId) : mThread(thread), mSessionId(sessionId), mActiveTrackCnt(0), mTrackCnt(0), mTailBufferCount(0), mOwnInBuffer(false), mVolumeCtrlIdx(-1), mLeftVolume(UINT_MAX), mRightVolume(UINT_MAX), mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX) mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX), mForceVolume(false) { mStrategy = AudioSystem::getStrategyForStream(AUDIO_STREAM_MUSIC); if (thread == NULL) { Loading Loading @@ -1649,7 +1654,8 @@ bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right) } } if (ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) { if (!isVolumeForced() && ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) { if (hasControl) { *left = mNewLeftVolume; *right = mNewRightVolume; Loading
services/audioflinger/Effects.h +7 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,12 @@ public: // At least one non offloadable effect in the chain is enabled bool isNonOffloadableEnabled(); // use release_cas because we don't care about the observed value, just want to make sure the // new value is observable. void forceVolume() { android_atomic_release_cas(false, true, &mForceVolume); } // use acquire_cas because we are interested in the observed value and // we are the only observers. bool isVolumeForced() { return (android_atomic_acquire_cas(true, false, &mForceVolume) == 0); } void dump(int fd, const Vector<String16>& args); Loading Loading @@ -375,4 +381,5 @@ protected: // timeLow fields among effect type UUIDs. // Updated by updateSuspendedSessions_l() only. KeyedVector< int, sp<SuspendedEffectDesc> > mSuspendedEffects; volatile int32_t mForceVolume; // force next volume command because a new effect was enabled };