summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Effects.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-09-12 17:37:00 -0700
committerEric Laurent <elaurent@google.com>2013-09-18 11:52:40 -0700
commit5baf2af52cd186633b7173196c1e4a4cd3435f22 (patch)
tree9c6752456812c4a927574a71e1d2ec2495ff6ce3 /services/audioflinger/Effects.cpp
parent9a98b6de791aeb130192df10744f5b35f8b6ef1a (diff)
downloadframeworks_av-5baf2af52cd186633b7173196c1e4a4cd3435f22.zip
frameworks_av-5baf2af52cd186633b7173196c1e4a4cd3435f22.tar.gz
frameworks_av-5baf2af52cd186633b7173196c1e4a4cd3435f22.tar.bz2
more support for audio effect offload
Offloading of audio effects is now enabled for offloaded output threads. If an effect not supporting offload is enabled, the AudioTrack is invalidated so that it can be recreated in PCM mode. Fix some issues in effect proxy related to handling of effect commands to offloaded and non offloaded effects. Also fixed a bug on capture index in software Visualizer effect. Bug: 8174034. Change-Id: Ib23d3c2d5a652361b0aaec7faee09102f2b18fce
Diffstat (limited to 'services/audioflinger/Effects.cpp')
-rw-r--r--services/audioflinger/Effects.cpp49
1 files changed, 44 insertions, 5 deletions
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 86671a9..0ca2107 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -764,6 +764,46 @@ bool AudioFlinger::EffectModule::purgeHandles()
return enabled;
}
+status_t AudioFlinger::EffectModule::setOffloaded(bool offloaded, audio_io_handle_t io)
+{
+ Mutex::Autolock _l(mLock);
+ if (mStatus != NO_ERROR) {
+ return mStatus;
+ }
+ status_t status = NO_ERROR;
+ if ((mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0) {
+ status_t cmdStatus;
+ uint32_t size = sizeof(status_t);
+ effect_offload_param_t cmd;
+
+ cmd.isOffload = offloaded;
+ cmd.ioHandle = io;
+ status = (*mEffectInterface)->command(mEffectInterface,
+ EFFECT_CMD_OFFLOAD,
+ sizeof(effect_offload_param_t),
+ &cmd,
+ &size,
+ &cmdStatus);
+ if (status == NO_ERROR) {
+ status = cmdStatus;
+ }
+ mOffloaded = (status == NO_ERROR) ? offloaded : false;
+ } else {
+ if (offloaded) {
+ status = INVALID_OPERATION;
+ }
+ mOffloaded = false;
+ }
+ ALOGV("setOffloaded() offloaded %d io %d status %d", offloaded, io, status);
+ return status;
+}
+
+bool AudioFlinger::EffectModule::isOffloaded() const
+{
+ Mutex::Autolock _l(mLock);
+ return mOffloaded;
+}
+
void AudioFlinger::EffectModule::dump(int fd, const Vector<String16>& args)
{
const size_t SIZE = 256;
@@ -932,14 +972,13 @@ status_t AudioFlinger::EffectHandle::enable()
}
mEnabled = false;
} else {
- //TODO: remove when effect offload is implemented
- if (thread != 0) {
+ if (thread != 0 && !mEffect->isOffloadable()) {
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();
+ thread->mAudioFlinger->onNonOffloadableGlobalEffectEnable();
}
}
}
@@ -1728,12 +1767,12 @@ void AudioFlinger::EffectChain::checkSuspendOnEffectEnabled(const sp<EffectModul
}
}
-bool AudioFlinger::EffectChain::isEnabled()
+bool AudioFlinger::EffectChain::isNonOffloadableEnabled()
{
Mutex::Autolock _l(mLock);
size_t size = mEffects.size();
for (size_t i = 0; i < size; i++) {
- if (mEffects[i]->isEnabled()) {
+ if (mEffects[i]->isEnabled() && !mEffects[i]->isOffloadable()) {
return true;
}
}