summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Effects.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-10-01 14:26:10 -0700
committerEric Laurent <elaurent@google.com>2014-10-01 16:52:30 -0700
commitcb4b6e9f05d1c0b3fcc5be5ebe3f7d6f32669b1a (patch)
tree7bf2965353146579d1af3a5015ec468029d1f5dc /services/audioflinger/Effects.cpp
parenta49c94ea49c8329a1bdefe980e1f7d335c0d1ec5 (diff)
downloadframeworks_av-cb4b6e9f05d1c0b3fcc5be5ebe3f7d6f32669b1a.zip
frameworks_av-cb4b6e9f05d1c0b3fcc5be5ebe3f7d6f32669b1a.tar.gz
frameworks_av-cb4b6e9f05d1c0b3fcc5be5ebe3f7d6f32669b1a.tar.bz2
audioflinger: fix failure to indicate volume to effect
If an effect is added and enabled after a track is started it will not receive current volume information because volume is indicated only to active effects and if there is a volume change. Add a flag to force EffectChain::setVolume_l() to pass volume indication to all effects each time an effect is enabled. Bug: 17572556. Change-Id: I6b68488c9aca8b2095fb210aa124d02e4f759660
Diffstat (limited to 'services/audioflinger/Effects.cpp')
-rw-r--r--services/audioflinger/Effects.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 15f1f23..4678880 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -465,16 +465,21 @@ status_t AudioFlinger::EffectModule::start_l()
if (status == 0) {
status = cmdStatus;
}
- if (status == 0 &&
- ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC ||
- (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC)) {
- sp<ThreadBase> thread = mThread.promote();
- if (thread != 0) {
- audio_stream_t *stream = thread->stream();
- if (stream != NULL) {
- stream->add_audio_effect(stream, mEffectInterface);
+ if (status == 0) {
+ if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC ||
+ (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) {
+ sp<ThreadBase> thread = mThread.promote();
+ if (thread != 0) {
+ audio_stream_t *stream = thread->stream();
+ if (stream != NULL) {
+ stream->add_audio_effect(stream, mEffectInterface);
+ }
}
}
+ sp<EffectChain> chain = mChain.promote();
+ if (chain != 0) {
+ chain->forceVolume();
+ }
}
return status;
}
@@ -1326,7 +1331,7 @@ AudioFlinger::EffectChain::EffectChain(ThreadBase *thread,
int sessionId)
: mThread(thread), mSessionId(sessionId), mActiveTrackCnt(0), mTrackCnt(0), mTailBufferCount(0),
mOwnInBuffer(false), mVolumeCtrlIdx(-1), mLeftVolume(UINT_MAX), mRightVolume(UINT_MAX),
- mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX)
+ mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX), mForceVolume(false)
{
mStrategy = AudioSystem::getStrategyForStream(AUDIO_STREAM_MUSIC);
if (thread == NULL) {
@@ -1649,7 +1654,8 @@ bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right)
}
}
- if (ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) {
+ if (!isVolumeForced() && ctrlIdx == mVolumeCtrlIdx &&
+ *left == mLeftVolume && *right == mRightVolume) {
if (hasControl) {
*left = mNewLeftVolume;
*right = mNewRightVolume;