summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/AudioPolicyManager.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-12-16 14:23:13 -0800
committerJean-Michel Trivi <jmtrivi@google.com>2014-12-16 14:23:13 -0800
commitfe472e292ab50c121ff93dffa3b54c96feedcfef (patch)
tree010d112dc7177e68d475686476e4f92c8e8f95a8 /services/audiopolicy/AudioPolicyManager.cpp
parent97bb33f58d742539f3382583d7978fca71ffa2d5 (diff)
downloadframeworks_av-fe472e292ab50c121ff93dffa3b54c96feedcfef.zip
frameworks_av-fe472e292ab50c121ff93dffa3b54c96feedcfef.tar.gz
frameworks_av-fe472e292ab50c121ff93dffa3b54c96feedcfef.tar.bz2
Fix routing not happening after change in output device list
If an output stream is active while rerouting rules are installed and recording starts, the list of outputs is not updated and therefore the stream is not rerouted to the new virtual device. The fix consists in also taking into account all the policy-related outputs when evaluating the before and after list of outputs following a connection state event. Bug 18736417 Change-Id: I6697976b3f89e2c0995e888e9046a2273361bb97
Diffstat (limited to 'services/audiopolicy/AudioPolicyManager.cpp')
-rw-r--r--services/audiopolicy/AudioPolicyManager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index a71aa53..51854c3 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -4055,6 +4055,24 @@ void AudioPolicyManager::checkOutputForStrategy(routing_strategy strategy)
SortedVector<audio_io_handle_t> srcOutputs = getOutputsForDevice(oldDevice, mPreviousOutputs);
SortedVector<audio_io_handle_t> dstOutputs = getOutputsForDevice(newDevice, mOutputs);
+ // also take into account external policy-related changes: add all outputs which are
+ // associated with policies in the "before" and "after" output vectors
+ ALOGVV("checkOutputForStrategy(): policy related outputs");
+ for (size_t i = 0 ; i < mPreviousOutputs.size() ; i++) {
+ const sp<AudioOutputDescriptor> desc = mPreviousOutputs.valueAt(i);
+ if (desc != 0 && desc->mPolicyMix != NULL) {
+ srcOutputs.add(desc->mIoHandle);
+ ALOGVV(" previous outputs: adding %d", desc->mIoHandle);
+ }
+ }
+ for (size_t i = 0 ; i < mOutputs.size() ; i++) {
+ const sp<AudioOutputDescriptor> desc = mOutputs.valueAt(i);
+ if (desc != 0 && desc->mPolicyMix != NULL) {
+ dstOutputs.add(desc->mIoHandle);
+ ALOGVV(" new outputs: adding %d", desc->mIoHandle);
+ }
+ }
+
if (!vectorsEqual(srcOutputs,dstOutputs)) {
ALOGV("checkOutputForStrategy() strategy %d, moving from output %d to output %d",
strategy, srcOutputs[0], dstOutputs[0]);