diff options
author | Scott Mertz <scott@cyngn.com> | 2015-12-03 12:02:57 -0800 |
---|---|---|
committer | Scott Mertz <scott@cyngn.com> | 2015-12-03 12:02:57 -0800 |
commit | 7e5939758a472d29486ee514177e9768f8ccba0d (patch) | |
tree | d4890f8f0fb3b5c3523d9a28e4aeffcf4c0ba7c3 | |
parent | 13a1747a5b0e87126bf46c6a5e874a2e06dc43a6 (diff) | |
parent | 080867091b96a52f544a24559d8c664939970790 (diff) | |
download | hardware_qcom_audio-7e5939758a472d29486ee514177e9768f8ccba0d.tar.gz hardware_qcom_audio-7e5939758a472d29486ee514177e9768f8ccba0d.tar.bz2 hardware_qcom_audio-7e5939758a472d29486ee514177e9768f8ccba0d.zip |
Merge remote-tracking branch 'caf/LA.BF64.1.2.2_rb4.8' into cm-13.0
-rw-r--r-- | hal/audio_extn/audio_extn.h | 2 | ||||
-rw-r--r-- | hal/audio_hw.c | 15 | ||||
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 42 |
3 files changed, 27 insertions, 32 deletions
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h index d1d995c1..30de3fb9 100644 --- a/hal/audio_extn/audio_extn.h +++ b/hal/audio_extn/audio_extn.h @@ -48,7 +48,7 @@ #define audio_is_offload_pcm(format) (0) #define OFFLOAD_USE_SMALL_BUFFER false #else -#define OFFLOAD_USE_SMALL_BUFFER ((info->format & AUDIO_FORMAT_PCM_OFFLOAD) == AUDIO_FORMAT_PCM_OFFLOAD) +#define OFFLOAD_USE_SMALL_BUFFER ((info->format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_PCM_OFFLOAD) #endif #ifndef AFE_PROXY_ENABLED diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 096d53c4..13940330 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -2166,6 +2166,21 @@ static char* out_get_parameters(const struct audio_stream *stream, const char *k } } + + ret = str_parms_get_str(query, "is_direct_pcm_track", value, sizeof(value)); + if (ret >= 0) { + value[0] = '\0'; + if (out->flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) { + ALOGV("in direct_pcm"); + strlcat(value, "true", strlen("true")); + } else { + ALOGV("not in direct_pcm"); + strlcat(value, "false", strlen("false")); + } + str_parms_add_str(reply, "is_direct_pcm_track", value); + str = str_parms_to_str(reply); + } + ret = str_parms_get_str(query, AUDIO_PARAMETER_STREAM_SUP_FORMATS, value, sizeof(value)); if (ret >= 0) { value[0] = '\0'; 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 |