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

Commit 31cb08bc authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "audio policy: fix flag matching in output selection"

parents 1b5d1cd0 e78b676a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1313,6 +1313,10 @@ audio_io_handle_t AudioPolicyManager::selectOutput(const SortedVector<audio_io_h
    audio_format_t bestFormat = AUDIO_FORMAT_INVALID;
    audio_format_t bestFormatForFlags = AUDIO_FORMAT_INVALID;

    // Flags which must be present on both the request and the selected output
    static const audio_output_flags_t kMandatedFlags = (audio_output_flags_t)
        (AUDIO_OUTPUT_FLAG_HW_AV_SYNC | AUDIO_OUTPUT_FLAG_MMAP_NOIRQ);

    for (audio_io_handle_t output : outputs) {
        sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
        if (!outputDesc->isDuplicated()) {
@@ -1336,6 +1340,10 @@ audio_io_handle_t AudioPolicyManager::selectOutput(const SortedVector<audio_io_h
                    continue;
                }
            }
            if ((kMandatedFlags & flags) !=
                (kMandatedFlags & outputDesc->mProfile->getFlags())) {
                continue;
            }

            // if a valid format is specified, skip output if not compatible
            if (format != AUDIO_FORMAT_INVALID) {