diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2015-04-15 21:11:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-15 21:12:01 +0000 |
commit | cfdd52423cee9efea73023feeaa74279ebd45b7c (patch) | |
tree | 154c4ea34b3fc95dbde268fb24be2f2915438c78 /services/audiopolicy/common/managerdefinitions/src | |
parent | 5e1c007038df74b389018e762d5059cacecff59e (diff) | |
parent | de80105c3f2db0eabd47640c49387ea3b44d4782 (diff) | |
download | frameworks_av-cfdd52423cee9efea73023feeaa74279ebd45b7c.zip frameworks_av-cfdd52423cee9efea73023feeaa74279ebd45b7c.tar.gz frameworks_av-cfdd52423cee9efea73023feeaa74279ebd45b7c.tar.bz2 |
Merge "AudioPolicyManager: notification of dynamic policy mix activity"
Diffstat (limited to 'services/audiopolicy/common/managerdefinitions/src')
-rw-r--r-- | services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp index 596aa1d..144d8ad 100644 --- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp @@ -225,7 +225,7 @@ SwAudioOutputDescriptor::SwAudioOutputDescriptor( : AudioOutputDescriptor(profile, clientInterface), mProfile(profile), mIoHandle(0), mLatency(0), mFlags((audio_output_flags_t)0), mPolicyMix(NULL), - mOutput1(0), mOutput2(0), mDirectOpenCount(0) + mOutput1(0), mOutput2(0), mDirectOpenCount(0), mGlobalRefCount(0) { if (profile != NULL) { mFlags = (audio_output_flags_t)profile->mFlags; @@ -305,6 +305,27 @@ void SwAudioOutputDescriptor::changeRefCount(audio_stream_type_t stream, mOutput2->changeRefCount(stream, delta); } AudioOutputDescriptor::changeRefCount(stream, delta); + + // handle stream-independent ref count + uint32_t oldGlobalRefCount = mGlobalRefCount; + if ((delta + (int)mGlobalRefCount) < 0) { + ALOGW("changeRefCount() invalid delta %d globalRefCount %d", delta, mGlobalRefCount); + mGlobalRefCount = 0; + } else { + mGlobalRefCount += delta; + } + if ((oldGlobalRefCount == 0) && (mGlobalRefCount > 0)) { + if ((mPolicyMix != NULL) && ((mPolicyMix->mFlags & MIX_FLAG_NOTIFY_ACTIVITY) != 0)) { + mClientInterface->onDynamicPolicyMixStateUpdate(mPolicyMix->mRegistrationId, + MIX_STATE_MIXING); + } + + } else if ((oldGlobalRefCount > 0) && (mGlobalRefCount == 0)) { + if ((mPolicyMix != NULL) && ((mPolicyMix->mFlags & MIX_FLAG_NOTIFY_ACTIVITY) != 0)) { + mClientInterface->onDynamicPolicyMixStateUpdate(mPolicyMix->mRegistrationId, + MIX_STATE_IDLE); + } + } } |