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

Commit 0d29b6db authored by Alexy Joseph's avatar Alexy Joseph Committed by Steve Kondik
Browse files

audiopolicy: Add support for multiple offload playback

Add support for multiple concurrent offload playback

Change-Id: Ib7ebf91db0c8c41e8354d2ef65c747e564d265fa
(cherry picked from commit 3cda51ca4117ad7f0f5f95d35bc0e14a272d3ebf)
parent 96c54002
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1391,6 +1391,18 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
    if (profile != 0) {
        sp<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 && ((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0))
            goto get_output__new_output_desc;
#endif
        for (size_t i = 0; i < mOutputs.size(); i++) {
            sp<AudioOutputDescriptor> desc = mOutputs.valueAt(i);
            if (!desc->isDuplicated() && (profile == desc->mProfile)) {
@@ -1409,6 +1421,7 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
        if (outputDesc != NULL) {
            closeOutput(outputDesc->mIoHandle);
        }
get_output__new_output_desc:
        outputDesc = new AudioOutputDescriptor(profile);
        outputDesc->mDevice = device;
        outputDesc->mLatency = 0;