diff options
author | qctecmdr <qctecmdr@localhost> | 2019-05-01 01:34:11 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-05-01 01:34:11 -0700 |
commit | 919f4e8dc35a57e26104ebb2426514aea1a81b9a (patch) | |
tree | df68b2a65fd379463206fd37b0afa672d910bdeb | |
parent | e5a9ad29975f4d6522e687d573ca72b3035c138e (diff) | |
parent | e49a3ec1d97172ffec44150c55175f680b97cb54 (diff) | |
download | android_vendor_qcom_opensource_audio-919f4e8dc35a57e26104ebb2426514aea1a81b9a.tar.gz android_vendor_qcom_opensource_audio-919f4e8dc35a57e26104ebb2426514aea1a81b9a.tar.bz2 android_vendor_qcom_opensource_audio-919f4e8dc35a57e26104ebb2426514aea1a81b9a.zip |
Merge "policy_hal: handle compress offload concurrency"
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 29aa176..99f1a24 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -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", |