summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-07-23 16:06:22 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-07-23 16:06:22 +0000
commit5ed59353281dfc0e5bfd1f896abe73f932bf9bf3 (patch)
tree2c3634d1b20339e95684ed5a4effaea14b6004e7
parent044bac40a166a8e7719e7735bf91e9522db752d3 (diff)
parent39b3abc0ca227d72f66bb47a75cec2acfb4d6de0 (diff)
downloadhardware_libhardware_legacy-5ed59353281dfc0e5bfd1f896abe73f932bf9bf3.zip
hardware_libhardware_legacy-5ed59353281dfc0e5bfd1f896abe73f932bf9bf3.tar.gz
hardware_libhardware_legacy-5ed59353281dfc0e5bfd1f896abe73f932bf9bf3.tar.bz2
am 39b3abc0: Merge "audio: add mechanism to re-route nullified audio"
* commit '39b3abc0ca227d72f66bb47a75cec2acfb4d6de0': audio: add mechanism to re-route nullified audio
-rw-r--r--audio/AudioPolicyManagerBase.cpp18
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index 1d49abb..7bca631 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -2845,7 +2845,22 @@ uint32_t AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output,
if (device != AUDIO_DEVICE_NONE) {
outputDesc->mDevice = device;
+
+ // Force routing if previously asked for this output
+ if (outputDesc->mForceRouting) {
+ ALOGV("Force routing to current device as previous device was null for this output");
+ force = true;
+
+ // Request consumed. Reset mForceRouting to false
+ outputDesc->mForceRouting = false;
+ }
}
+ else {
+ // Device is null and does not reflect the routing. Save the necessity to force
+ // re-routing upon next attempt to select a non-null device for this output
+ outputDesc->mForceRouting = true;
+ }
+
muteWaitMs = checkDeviceMuteStrategies(outputDesc, prevDevice, delayMs);
// Do not change the routing if:
@@ -3466,7 +3481,8 @@ AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor(
: mId(0), mSamplingRate(0), mFormat(AUDIO_FORMAT_DEFAULT),
mChannelMask(0), mLatency(0),
mFlags((audio_output_flags_t)0), mDevice(AUDIO_DEVICE_NONE),
- mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0)
+ mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0),
+ mForceRouting(false)
{
// clear usage count for all stream types
for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h
index c5aac7b..b97ce40 100644
--- a/include/hardware_legacy/AudioPolicyManagerBase.h
+++ b/include/hardware_legacy/AudioPolicyManagerBase.h
@@ -287,6 +287,7 @@ protected:
bool mStrategyMutedByDevice[NUM_STRATEGIES]; // strategies muted because of incompatible
// device selection. See checkDeviceMuteStrategies()
uint32_t mDirectOpenCount; // number of clients using this output (direct outputs only)
+ bool mForceRouting; // Next routing for this output will be forced as current device routed is null
};
// descriptor for audio inputs. Used to maintain current configuration of each opened audio input