summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhou Song <zhous@codeaurora.org>2016-03-21 17:21:04 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-04-07 05:29:48 -0700
commit6540c07662ebf0fe7478af3c4678c59977aed3c9 (patch)
treee562664c5f70c418b64a7667e2326d910f525a90
parent354a07ccd238ef2982b91141047c019720f4bcdc (diff)
downloadandroid_hardware_qcom_audio-6540c07662ebf0fe7478af3c4678c59977aed3c9.tar.gz
android_hardware_qcom_audio-6540c07662ebf0fe7478af3c4678c59977aed3c9.tar.bz2
android_hardware_qcom_audio-6540c07662ebf0fe7478af3c4678c59977aed3c9.zip
audiopolicy: check active direct output before adding DIRECT_PCM flag
When getting new output with DIRECT_PCM flag set, the existing direct pcm output can be closed and interrupted mutually with the requested one. Don't add DIRECT_PCM flag if there's an active direct output for track offload. Change-Id: I250c9555dff2c17f94b57a14a1722bae00fe9f9b CRs-Fixed: 986087
-rw-r--r--policy_hal/AudioPolicyManager.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 6ba5fddd..4ea29627 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1601,10 +1601,21 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
flags = AUDIO_OUTPUT_FLAG_TTS;
}
+ // check if direct output for track offload already exits
+ bool is_track_offload_active = false;
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i);
+ if (desc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) {
+ is_track_offload_active = true;
+ ALOGD("Track offload already active");
+ break;
+ }
+ }
+
// Do offload magic here
if ((flags == AUDIO_OUTPUT_FLAG_NONE) &&
(stream == AUDIO_STREAM_MUSIC) &&
- (offloadInfo != NULL) &&
+ (offloadInfo != NULL) && !is_track_offload_active &&
((offloadInfo->usage == AUDIO_USAGE_MEDIA) || (offloadInfo->usage == AUDIO_USAGE_GAME))) {
flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_DIRECT_PCM);
ALOGD("AudioCustomHAL --> Force Direct Flag .. flag (0x%x)", flags);