Merge "policy: Add support for multiple instances of offload playback"

This commit is contained in:
Linux Build Service Account 2014-04-28 19:33:55 -07:00 committed by Gerrit - the friendly Code Review server
commit 31443fcfda
2 changed files with 16 additions and 0 deletions

View File

@ -39,6 +39,9 @@ LOCAL_CFLAGS += -DVOICE_CONCURRENCY
LOCAL_CFLAGS += -DWFD_CONCURRENCY
endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTIPLE_TUNNEL)), true)
LOCAL_CFLAGS += -DMULTIPLE_OFFLOAD_ENABLED
endif
include $(BUILD_SHARED_LIBRARY)

View File

@ -1324,6 +1324,18 @@ audio_io_handle_t AudioPolicyManager::getOutput(AudioSystem::stream_type stream,
if (profile != NULL) {
AudioOutputDescriptor *outputDesc = NULL;
#ifdef MULTIPLE_OFFLOAD_ENABLED
bool multiOffloadEnabled = false;
char value[PROPERTY_VALUE_MAX] = {0};
property_get("audio.offload.multiple.enabled", value, NULL);
if (atoi(value) || !strncmp("true", value, 4))
multiOffloadEnabled = true;
// if multiple concurrent offload decode is supported
// do no check for reuse and also don't close previous output if its offload
// previous output will be closed during track destruction
if (multiOffloadEnabled)
goto get_output__new_output_desc;
#endif
for (size_t i = 0; i < mOutputs.size(); i++) {
AudioOutputDescriptor *desc = mOutputs.valueAt(i);
if (!desc->isDuplicated() && (profile == desc->mProfile)) {
@ -1342,6 +1354,7 @@ audio_io_handle_t AudioPolicyManager::getOutput(AudioSystem::stream_type stream,
if (outputDesc != NULL) {
closeOutput(outputDesc->mId);
}
get_output__new_output_desc:
outputDesc = new AudioOutputDescriptor(profile);
outputDesc->mDevice = device;
outputDesc->mSamplingRate = samplingRate;