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

Commit ed3d00c0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "policy_hal: Update offload disabled flags"

parents 6c6171bd 0ac0903e
Loading
Loading
Loading
Loading
+25 −8
Original line number Diff line number Diff line
@@ -397,6 +397,13 @@ bool AudioPolicyManagerCustom::isOffloadSupported(const audio_offload_info_t& of
        return false;
    }

    // Check if offload has been disabled
    bool offloadDisabled = property_get_bool("audio.offload.disable", false);
    if (offloadDisabled) {
        ALOGI("offload disabled by audio.offload.disable=%d", offloadDisabled);
        return false;
    }

    char propValue[PROPERTY_VALUE_MAX];
    bool pcmOffload = false;
#ifdef PCM_OFFLOAD_ENABLED
@@ -426,13 +433,13 @@ bool AudioPolicyManagerCustom::isOffloadSupported(const audio_offload_info_t& of
    }
#endif
    if (!pcmOffload) {
        // Check if offload has been disabled
        if (property_get("audio.offload.disable", propValue, "0")) {
            if (atoi(propValue) != 0) {
                ALOGV("offload disabled by audio.offload.disable=%s", propValue );

        bool compressedOffloadDisabled = property_get_bool("audio.offload.compress.disable", false);
        if (compressedOffloadDisabled) {
            ALOGI("compressed offload disabled by audio.offload.compress.disable=%d", compressedOffloadDisabled);
            return false;
        }
        }

        //check if it's multi-channel AAC (includes sub formats) and FLAC format
        if ((popcount(offloadInfo.channel_mask) > 2) &&
           (((offloadInfo.format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_AAC) ||
@@ -1264,7 +1271,17 @@ status_t AudioPolicyManagerCustom::getOutputForAttr(const audio_attributes_t *at
{
    audio_offload_info_t tOffloadInfo = AUDIO_INFO_INITIALIZER;

    bool pcmOffloadEnabled = property_get_bool("audio.offload.track.enable", false);
    bool offloadDisabled = property_get_bool("audio.offload.disable", false);
    bool pcmOffloadEnabled = false;

    if (offloadDisabled) {
        ALOGI("offload disabled by audio.offload.disable=%d", offloadDisabled);
    }

    //read track offload property only if the global offload switch is off.
    if (!offloadDisabled) {
         pcmOffloadEnabled = property_get_bool("audio.offload.track.enable", false);
    }

    if (offloadInfo == NULL && pcmOffloadEnabled) {
        tOffloadInfo.sample_rate  = samplingRate;
@@ -1276,7 +1293,7 @@ status_t AudioPolicyManagerCustom::getOutputForAttr(const audio_attributes_t *at
            ALOGV("found attribute .. setting usage %d ", attr->usage);
            tOffloadInfo.usage = attr->usage;
        } else {
            ALOGD("%s:: attribute is NULL .. no usage set", __func__);
            ALOGI("%s:: attribute is NULL .. no usage set", __func__);
        }
        offloadInfo = &tOffloadInfo;
    }