Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5eb02f74 authored by Subhash Chandra Bose Naripeddy's avatar Subhash Chandra Bose Naripeddy Committed by Gerrit - the friendly Code Review server
Browse files

policy: Add support for multiple instances of offload playback

Add support for multiple offload playback instances

Change-Id: Icab3c7d6e89121a7aa23744729a634d8e402fabf
parent 87f0102b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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)
+13 −0
Original line number Diff line number Diff line
@@ -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;