diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2019-05-06 11:18:40 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2019-05-06 11:18:40 -0700 |
commit | 527fdd312a694da227ac0e9984d34687e3c90c63 (patch) | |
tree | 47bf8111db17df2e896c442856c0f2df6168e9df | |
parent | b0b7a31a102a604aa456a4a7cfc5a2ee4d456b22 (diff) | |
parent | 919f4e8dc35a57e26104ebb2426514aea1a81b9a (diff) | |
download | android_vendor_qcom_opensource_audio-527fdd312a694da227ac0e9984d34687e3c90c63.tar.gz android_vendor_qcom_opensource_audio-527fdd312a694da227ac0e9984d34687e3c90c63.tar.bz2 android_vendor_qcom_opensource_audio-527fdd312a694da227ac0e9984d34687e3c90c63.zip |
Merge 919f4e8dc35a57e26104ebb2426514aea1a81b9a on remote branch
Change-Id: Ic8ba602d77edebedd3952861855850b5cd5e658f
-rwxr-xr-x | policy_hal/AudioPolicyManager.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index cc5747c..99f1a24 100755 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -522,7 +522,7 @@ bool AudioPolicyManagerCustom::isOffloadSupported(const audio_offload_info_t& of } // Check if offload has been disabled - bool offloadDisabled = property_get_bool("audio.offload.disable", false); + bool offloadDisabled = mApmConfigs->isAudioOffloadDisabled(); if (offloadDisabled) { ALOGI("offload disabled by audio.offload.disable=%d", offloadDisabled); return false; @@ -1639,7 +1639,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevices( } // Do internal direct magic here - bool offload_disabled = property_get_bool("audio.offload.disable", false); + bool offload_disabled = mApmConfigs->isAudioOffloadDisabled(); if ((*flags == AUDIO_OUTPUT_FLAG_NONE) && (stream == AUDIO_STREAM_MUSIC) && ( !offload_disabled) && @@ -1654,9 +1654,10 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevices( *flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_NONE); } - // check if direct output for pcm/track offload already exits + // check if direct output for pcm/track offload or compress offload already exist bool direct_pcm_already_in_use = false; - if (*flags == AUDIO_OUTPUT_FLAG_DIRECT) { + bool compress_offload_already_in_use = false; + if (*flags & AUDIO_OUTPUT_FLAG_DIRECT) { for (size_t i = 0; i < mOutputs.size(); i++) { sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i); if (desc->mFlags == AUDIO_OUTPUT_FLAG_DIRECT) { @@ -1664,6 +1665,11 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevices( ALOGD("Direct PCM already in use"); break; } + if (desc->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { + compress_offload_already_in_use = true; + ALOGD("Compress Offload already in use"); + break; + } } // prevent direct pcm for non-music stream blindly if direct pcm already in use // for other music stream concurrency is handled after checking direct ouput usage @@ -1677,9 +1683,10 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevices( 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); + *flags = (audio_output_flags_t)(*flags & ~AUDIO_OUTPUT_FLAG_DEEP_BUFFER); } else if (/* stream == AUDIO_STREAM_MUSIC && */ - (*flags == AUDIO_OUTPUT_FLAG_NONE || *flags == AUDIO_OUTPUT_FLAG_DIRECT) && + (*flags == AUDIO_OUTPUT_FLAG_NONE || *flags == AUDIO_OUTPUT_FLAG_DIRECT || + (*flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)) && mApmConfigs->isAudioDeepbufferMediaEnabled() && !isInCall()) { forced_deep = true; } @@ -1764,8 +1771,9 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevices( } } if (outputDesc != NULL) { - if (*flags == AUDIO_OUTPUT_FLAG_DIRECT && - direct_pcm_already_in_use == true && + if ((((*flags == AUDIO_OUTPUT_FLAG_DIRECT) && direct_pcm_already_in_use) || + ((*flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) && + compress_offload_already_in_use)) && session != outputDesc->mDirectClientSession) { ALOGV("getOutput() do not reuse direct pcm output because current client (%d) " "is not the same as requesting client (%d) for different output conf", |