From d15a8bd157cb531716bd3e15561f557e74588801 Mon Sep 17 00:00:00 2001 From: Lucas Gomez Jimenez Date: Thu, 30 Jul 2015 09:53:47 +0200 Subject: Audio Effects are not processing first buffer Current implementation in AudioFlinger set the effects to state IDLE when they are created. Later on when the effect is enabled by the client, the state changes to STARTING. Then when the audio playback starts, the AudioFlinger thread loop calls EffectChain::process_l() to perform the effects processing. However this method will first call process() and then updateState(), so the firstprocess won't do anything because the effect is in STARTING state. After the call to updateState, the state is moved to ACTIVE and then next calls to process_l() will work as expected. Change-Id: I9dfd3d5a0e53403034eb42f9366e1b3cdc5249c0 --- services/audioflinger/Effects.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'services/audioflinger/Effects.cpp') diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp index 54ca6c3..19fc942 100644 --- a/services/audioflinger/Effects.cpp +++ b/services/audioflinger/Effects.cpp @@ -1462,14 +1462,14 @@ void AudioFlinger::EffectChain::process_l() } size_t size = mEffects.size(); + for (size_t i = 0; i < size; i++) { + mEffects[i]->updateState(); + } if (doProcess) { for (size_t i = 0; i < size; i++) { mEffects[i]->process(); } } - for (size_t i = 0; i < size; i++) { - mEffects[i]->updateState(); - } } // addEffect_l() must be called with PlaybackThread::mLock held -- cgit v1.1