diff options
Diffstat (limited to 'policy_hal/AudioPolicyManager.cpp')
-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", |