diff options
author | vivek mehta <mvivek@codeaurora.org> | 2015-11-24 00:30:39 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-19 02:46:24 -0500 |
commit | 05f67ffe45268807d2782a9d1c0cf212956fa925 (patch) | |
tree | 424a7ed6151e15a3b396fe8054956e1236a091df /services/audioflinger | |
parent | d5dee706a6f0a0b5a4a65e8e128131f06d572e6b (diff) | |
download | frameworks_av-05f67ffe45268807d2782a9d1c0cf212956fa925.zip frameworks_av-05f67ffe45268807d2782a9d1c0cf212956fa925.tar.gz frameworks_av-05f67ffe45268807d2782a9d1c0cf212956fa925.tar.bz2 |
libaudioflinger: avoid s/w effect processing in case of Direct PCM
- Check Direct PCM usecase with Offload
- do not process s/w effect when direct PCM is enabled
Change-Id: I2eb843b17558e60cf36daff0c5fbdf50dccf99ca
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/Effects.cpp | 10 | ||||
-rw-r--r-- | services/audioflinger/Threads.cpp | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp index 19fc942..fb1e80c 100644 --- a/services/audioflinger/Effects.cpp +++ b/services/audioflinger/Effects.cpp @@ -1120,7 +1120,8 @@ status_t AudioFlinger::EffectHandle::enable() t->broadcast_l(); } if (!mEffect->isOffloadable()) { - if (thread->type() == ThreadBase::OFFLOAD) { + if (thread->type() == ThreadBase::OFFLOAD || + (thread->type() == ThreadBase::DIRECT && thread->mIsDirectPcm)) { PlaybackThread *t = (PlaybackThread *)thread.get(); t->invalidateTracks(AUDIO_STREAM_MUSIC); } @@ -1157,7 +1158,8 @@ status_t AudioFlinger::EffectHandle::disable() sp<ThreadBase> thread = mEffect->thread().promote(); if (thread != 0) { thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId()); - if (thread->type() == ThreadBase::OFFLOAD) { + if ((thread->type() == ThreadBase::OFFLOAD) || + (thread->type() == ThreadBase::DIRECT && thread->mIsDirectPcm)){ PlaybackThread *t = (PlaybackThread *)thread.get(); Mutex::Autolock _l(t->mLock); t->broadcast_l(); @@ -1440,8 +1442,10 @@ void AudioFlinger::EffectChain::process_l() (mSessionId == AUDIO_SESSION_OUTPUT_STAGE); // never process effects when: // - on an OFFLOAD thread + // - on DIRECT thread with directPcm flag enabled // - no more tracks are on the session and the effect tail has been rendered - bool doProcess = (thread->type() != ThreadBase::OFFLOAD); + bool doProcess = ((thread->type() != ThreadBase::OFFLOAD) && + (!(thread->type() == ThreadBase::DIRECT && thread->mIsDirectPcm))); if (!isGlobalSession) { bool tracksOnSession = (trackCnt() != 0); diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index bc7b7dc..71673c3 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -2914,7 +2914,8 @@ bool AudioFlinger::PlaybackThread::threadLoop() } // only process effects if we're going to write - if (mSleepTimeUs == 0 && mType != OFFLOAD) { + if (mSleepTimeUs == 0 && mType != OFFLOAD && + !(mType == DIRECT && mIsDirectPcm)) { for (size_t i = 0; i < effectChains.size(); i ++) { effectChains[i]->process_l(); } @@ -2924,7 +2925,7 @@ bool AudioFlinger::PlaybackThread::threadLoop() // was read from audio track: process only updates effect state // and thus does have to be synchronized with audio writes but may have // to be called while waiting for async write callback - if (mType == OFFLOAD) { + if ((mType == OFFLOAD) || (mType == DIRECT && mIsDirectPcm)) { for (size_t i = 0; i < effectChains.size(); i ++) { effectChains[i]->process_l(); } |