From 813e2a74853bde19e37d878c596a044b3f299efc Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Sat, 31 Aug 2013 12:59:48 -0700 Subject: audioflinger: no effects on offloaded tracks Invalidate offloaded tracks when an effect is enabled so that the track is recreated in PCM mode and the effect can be applied. This is temporary until effect offloading is implemented. Bug: 8174034. Change-Id: I77b8b54a10db6cb8334be76d863ea7e720eaad09 --- services/audioflinger/Effects.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'services/audioflinger/Effects.cpp') diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp index d5a21a7..86671a9 100644 --- a/services/audioflinger/Effects.cpp +++ b/services/audioflinger/Effects.cpp @@ -593,17 +593,6 @@ status_t AudioFlinger::EffectModule::setEnabled_l(bool enabled) h->setEnabled(enabled); } } -//EL_FIXME not sure why this is needed? -// sp thread = mThread.promote(); -// if (thread == 0) { -// return NO_ERROR; -// } -// -// if ((thread->type() == ThreadBase::OFFLOAD) && (enabled)) { -// PlaybackThread *p = (PlaybackThread *)thread.get(); -// ALOGV("setEnabled: Offload, invalidate tracks"); -// p->invalidateTracks(AUDIO_STREAM_MUSIC); -// } } return NO_ERROR; } @@ -942,6 +931,17 @@ status_t AudioFlinger::EffectHandle::enable() thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId()); } mEnabled = false; + } else { + //TODO: remove when effect offload is implemented + if (thread != 0) { + if ((thread->type() == ThreadBase::OFFLOAD)) { + PlaybackThread *t = (PlaybackThread *)thread.get(); + t->invalidateTracks(AUDIO_STREAM_MUSIC); + } + if (mEffect->sessionId() == AUDIO_SESSION_OUTPUT_MIX) { + thread->mAudioFlinger->onGlobalEffectEnable(); + } + } } return status; } @@ -1728,4 +1728,16 @@ void AudioFlinger::EffectChain::checkSuspendOnEffectEnabled(const spisEnabled()) { + return true; + } + } + return false; +} + }; // namespace android -- cgit v1.1