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

Commit ced57302 authored by Andy Hung's avatar Andy Hung
Browse files

AudioPolicyManager: Do not allow secondary outputs with PCM offload

Test: Live Caption
Flag: EXEMPT bugfix
Bug: 359862350
Merged-In: Ibb8821415540170d5614af95e8383ae9c368dc38
Change-Id: Ibb8821415540170d5614af95e8383ae9c368dc38
parent 3eba0898
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -1251,7 +1251,8 @@ status_t AudioPolicyManager::getOutputForAttrInt(


    // FIXME: in case of RENDER policy, the output capabilities should be checked
    // FIXME: in case of RENDER policy, the output capabilities should be checked
    if ((secondaryMixes != nullptr && !secondaryMixes->empty())
    if ((secondaryMixes != nullptr && !secondaryMixes->empty())
            && !audio_is_linear_pcm(config->format)) {
            && (!audio_is_linear_pcm(config->format) ||
                    *flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)) {
        ALOGD("%s: rejecting request as secondary mixes only support pcm", __func__);
        ALOGD("%s: rejecting request as secondary mixes only support pcm", __func__);
        return BAD_VALUE;
        return BAD_VALUE;
    }
    }
@@ -7415,7 +7416,8 @@ void AudioPolicyManager::checkSecondaryOutputs() {
                    client->getSecondaryOutputs().begin(),
                    client->getSecondaryOutputs().begin(),
                    client->getSecondaryOutputs().end(),
                    client->getSecondaryOutputs().end(),
                    secondaryDescs.begin(), secondaryDescs.end())) {
                    secondaryDescs.begin(), secondaryDescs.end())) {
                if (!audio_is_linear_pcm(client->config().format)) {
                if (client->flags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD
                        || !audio_is_linear_pcm(client->config().format)) {
                    // If the format is not PCM, the tracks should be invalidated to get correct
                    // If the format is not PCM, the tracks should be invalidated to get correct
                    // behavior when the secondary output is changed.
                    // behavior when the secondary output is changed.
                    clientsToInvalidate.push_back(client->portId());
                    clientsToInvalidate.push_back(client->portId());