Merge "Allow volume setting only for offloadable effect for Offload" am: 311d0133a4 am: cdca8b4205
am: f4942d7989
Change-Id: I47468b938913f77e68a7bde41105b4c92a57f58d
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index c4c742e..6cab441 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1157,7 +1157,8 @@
{
sp<ThreadBase> thread = mThread.promote();
if (thread != 0 &&
- (thread->type() == ThreadBase::OFFLOAD || thread->type() == ThreadBase::DIRECT)) {
+ (thread->type() == ThreadBase::OFFLOAD || thread->type() == ThreadBase::DIRECT) &&
+ !isNonOffloadableEnabled_l()) {
PlaybackThread *t = (PlaybackThread *)thread.get();
float vol_l = (float)left / (1 << 24);
float vol_r = (float)right / (1 << 24);
@@ -2552,6 +2553,11 @@
bool AudioFlinger::EffectChain::isNonOffloadableEnabled()
{
Mutex::Autolock _l(mLock);
+ return isNonOffloadableEnabled_l();
+}
+
+bool AudioFlinger::EffectChain::isNonOffloadableEnabled_l()
+{
size_t size = mEffects.size();
for (size_t i = 0; i < size; i++) {
if (mEffects[i]->isEnabled() && !mEffects[i]->isOffloadable()) {
diff --git a/services/audioflinger/Effects.h b/services/audioflinger/Effects.h
index e04ee8e..15a26ea 100644
--- a/services/audioflinger/Effects.h
+++ b/services/audioflinger/Effects.h
@@ -378,6 +378,7 @@
// At least one non offloadable effect in the chain is enabled
bool isNonOffloadableEnabled();
+ bool isNonOffloadableEnabled_l();
void syncHalEffectsState();