From e912bfd79880ea5faac0fbcdb4e696125e151e18 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 31 Oct 2012 10:50:12 -0700 Subject: audio policy: direct output fix - DO NOT MERGE merge "Close a newly opened direct output if its parameters are invalid" from master Change-Id: I27ac015217480a854d25273ab9498949971b411a --- audio/AudioPolicyManagerBase.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'audio') diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index b4f4778..5d87399 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -1672,6 +1672,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, ((profile->mFormats[0] == 0) && (profile->mChannelMasks.size() < 2))) { ALOGW("checkOutputsForDevice() direct output missing param"); + mpClientInterface->closeOutput(output); output = 0; } else { addOutput(output, desc); -- cgit v1.2.3 From da06cb6142faa3e09cbf7226ca9c75e45661095b Mon Sep 17 00:00:00 2001 From: John Grossman Date: Mon, 29 Oct 2012 18:42:43 -0700 Subject: audio policy: fix dynamic parameter - DO NOT MERGE merge from master: "Fix a parse error in checkOutputForDevice Fix a small parsing error in parsing the supported formats and sample rates of a stream out with dynamic values for these parameters. The channel mask parser was properly skipping the "=" in the setting string, but formats and sample rates were not (cauing the first reported format and sample rate to end up being skipped)" Change-Id: Id227a44f6b5fc0c223f2ce74f94ebb6abc5fa77d Signed-off-by: John Grossman --- audio/AudioPolicyManagerBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 5d87399..a082239 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -1642,7 +1642,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, reply.string()); value = strpbrk((char *)reply.string(), "="); if (value != NULL) { - loadSamplingRates(value, profile); + loadSamplingRates(value + 1, profile); } } if (profile->mFormats[0] == 0) { @@ -1652,7 +1652,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, reply.string()); value = strpbrk((char *)reply.string(), "="); if (value != NULL) { - loadFormats(value, profile); + loadFormats(value + 1, profile); } } if (profile->mChannelMasks[0] == 0) { -- cgit v1.2.3 From fe43d163d6646a175934f0752fa05e3e53e89da4 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 30 Oct 2012 16:14:04 -0700 Subject: audio policy: fix volume problem - DO NOT MERGE merge from master: "audio policy: fix volume change when disabling SCO commit 76e97d39 introduced a regression by having setDeviceConnectionState() force a device change on duplicated outputs even if the selected device is 0. This also forces a device 0 for the two outputs it is duplicated to, which may override a valid device selection on those outputs and apply default volumes. Bug 7429869." Change-Id: I37dd66343c54eb27e420089edbda04444fa1e2c6 --- audio/AudioPolicyManagerBase.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index a082239..19fff57 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -169,9 +169,12 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device updateDevicesAndOutputs(); for (size_t i = 0; i < mOutputs.size(); i++) { + // do not force device change on duplicated output because if device is 0, it will + // also force a device 0 for the two outputs it is duplicated to which may override + // a valid device selection on those outputs. setOutputDevice(mOutputs.keyAt(i), getNewDevice(mOutputs.keyAt(i), true /*fromCache*/), - true, + !mOutputs.valueAt(i)->isDuplicated(), 0); } -- cgit v1.2.3 From a7c17deb32fe28230b77b0dff17bb113088a5c16 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 7 Nov 2012 12:09:54 -0800 Subject: audio policy: notification delay - DO NOT MERGE merge from master: "audio policy: fix notification start delay The mechanism delaying notifications in case of muliple active outputs with long latencies must take into account recently paused audio tracks. Bug 7400428." Change-Id: I4ac9dfac81336e33f475b4f28df82713707d0c46 --- audio/AudioPolicyManagerBase.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'audio') diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 19fff57..134fb3b 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -348,7 +348,7 @@ void AudioPolicyManagerBase::setPhoneState(int state) for (size_t i = 0; i < mOutputs.size(); i++) { AudioOutputDescriptor *desc = mOutputs.valueAt(i); //take the biggest latency for all outputs - if (delayMs < desc->mLatency*2) { + if (delayMs < (int)desc->mLatency*2) { delayMs = desc->mLatency*2; } //mute STRATEGY_MEDIA on all outputs @@ -702,8 +702,9 @@ status_t AudioPolicyManagerBase::startOutput(audio_io_handle_t output, } // wait for audio on other active outputs to be presented when starting // a notification so that audio focus effect can propagate. - if (shouldWait && (desc->refCount() != 0) && (waitMs < desc->latency())) { - waitMs = desc->latency(); + uint32_t latency = desc->latency(); + if (shouldWait && desc->isActive(latency * 2) && (waitMs < latency)) { + waitMs = latency; } } } @@ -3065,6 +3066,18 @@ audio_devices_t AudioPolicyManagerBase::AudioOutputDescriptor::supportedDevices( } } +bool AudioPolicyManagerBase::AudioOutputDescriptor::isActive(uint32_t inPastMs) const +{ + nsecs_t sysTime = systemTime(); + for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { + if (mRefCount[i] != 0 || + ns2ms(sysTime - mStopTime[i]) < inPastMs) { + return true; + } + } + return false; +} + status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd) { const size_t SIZE = 256; -- cgit v1.2.3