audioflinger: fix effect volume set on start.
commit fa1e123f forced effect volume to be re applied when
an effect is enabled regardless of the fact that the volume was
already set or not on the effect chain. This caused a systematic
volume command to be send with an invalid value immediately
followed by the correct value.
Bug: 30458082
Change-Id: Ida4b5d7e96c2d4da298589c37c2ce98541a9396a
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 4cde70d..e3e518c 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1733,9 +1733,11 @@
// resetVolume_l() must be called with PlaybackThread::mLock or EffectChain::mLock held
void AudioFlinger::EffectChain::resetVolume_l()
{
- uint32_t left = mLeftVolume;
- uint32_t right = mRightVolume;
- (void)setVolume_l(&left, &right, true);
+ if ((mLeftVolume != UINT_MAX) && (mRightVolume != UINT_MAX)) {
+ uint32_t left = mLeftVolume;
+ uint32_t right = mRightVolume;
+ (void)setVolume_l(&left, &right, true);
+ }
}
void AudioFlinger::EffectChain::syncHalEffectsState()