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

Commit 8b634267 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HiRes: Check mixport samplerates" into main

parents 2e055731 67c12fe4
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2086,7 +2086,14 @@ audio_io_handle_t AudioPolicyManager::selectOutput(const SortedVector<audio_io_h

        // sampling rate match
        if (samplingRate > SAMPLE_RATE_HZ_DEFAULT) {
            currentMatchCriteria[4] = outputDesc->getSamplingRate();
            int diff;  // avoid unsigned integer overflow.
            __builtin_sub_overflow(outputDesc->getSamplingRate(), samplingRate, &diff);

            // prefer the closest output sampling rate greater than or equal to target
            // if none exists, prefer the closest output sampling rate less than target.
            //
            // criteria is offset to make non-negative.
            currentMatchCriteria[4] = diff >= 0 ? -diff + 200'000'000 : diff + 100'000'000;
        }

        // performance flags match