diff options
author | vivek mehta <mvivek@codeaurora.org> | 2015-10-16 00:25:59 -0700 |
---|---|---|
committer | vivek mehta <mvivek@codeaurora.org> | 2015-11-10 13:27:45 -0800 |
commit | c5f7608f2b41b933146a5a92312ae4826e74d601 (patch) | |
tree | 1e17e693f4ef555f8fe8c11a008885e523f90eea | |
parent | 040a7e7fdd6bd6fa7975bae257a62d0c70fa37ff (diff) | |
download | hardware_qcom_audio-c5f7608f2b41b933146a5a92312ae4826e74d601.tar.gz hardware_qcom_audio-c5f7608f2b41b933146a5a92312ae4826e74d601.tar.bz2 hardware_qcom_audio-c5f7608f2b41b933146a5a92312ae4826e74d601.zip |
hal: policy: fallback to deep buffer if stream is music
- in case of direct PCM, Direct flag is added explicitly which
is causing deep buffer flag not to be added for Music case.
- absence of deep buffer flag is causing low latency path to be
selected by default if direct pcm fails. Fastmixer path has
higher power footprint.
- to avoid low latency and allow stream music to use deep buffer path
check if direct flag is added explicitly, if so allow adding
deep buffer flag. This will allow selecting deep buffer output.
Change-Id: Icc1de9f4ac3ff7981d2325fbda4891d9b8476df7
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 112ab284..2b567b18 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -1485,48 +1485,28 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice( flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT); } - // Do offload magic here - if ((flags == AUDIO_OUTPUT_FLAG_NONE) && (stream == AUDIO_STREAM_MUSIC) && - (offloadInfo != NULL) && - ((offloadInfo->usage == AUDIO_USAGE_MEDIA || - (offloadInfo->usage == AUDIO_USAGE_GAME)))) { - if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) == 0) { - ALOGD("AudioCustomHAL --> Force Direct Flag .."); - flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT); - } - } - - // only allow deep buffering for music stream type - if (stream != AUDIO_STREAM_MUSIC) { - flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER); - } - if (stream == AUDIO_STREAM_TTS) { - flags = AUDIO_OUTPUT_FLAG_TTS; - } - - // open a direct output if required by specified parameters - //force direct flag if offload flag is set: offloading implies a direct output stream - // and all common behaviors are driven by checking only the direct flag - // this should normally be set appropriately in the policy configuration file - if ((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0) { - flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT); - } - if ((flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC) != 0) { - flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT); - } + bool forced_deep = false; // only allow deep buffering for music stream type if (stream != AUDIO_STREAM_MUSIC) { flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER); } else if (/* stream == AUDIO_STREAM_MUSIC && */ flags == AUDIO_OUTPUT_FLAG_NONE && property_get_bool("audio.deep_buffer.media", false /* default_value */)) { - flags = (audio_output_flags_t)AUDIO_OUTPUT_FLAG_DEEP_BUFFER; + flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_DEEP_BUFFER); + forced_deep = true; } - if (stream == AUDIO_STREAM_TTS) { flags = AUDIO_OUTPUT_FLAG_TTS; } + // Do offload magic here + if (((flags == AUDIO_OUTPUT_FLAG_NONE) || forced_deep) && + (stream == AUDIO_STREAM_MUSIC) && (offloadInfo != NULL) && + ((offloadInfo->usage == AUDIO_USAGE_MEDIA) || (offloadInfo->usage == AUDIO_USAGE_GAME))) { + flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT); + ALOGD("AudioCustomHAL --> Force Direct Flag .. flag (0x%x)", flags); + } + sp<IOProfile> profile; // skip direct output selection if the request can obviously be attached to a mixed output |