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

Commit e9afda02 authored by Phil Burk's avatar Phil Burk Committed by android-build-merger
Browse files

Merge "aaudio: fix returned performanceMode for Legacy" into oc-mr1-dev

am: c35e23e5

Change-Id: Ia7a648b9ebe154f6bafb3002f4f3a84db63e7321
parents 8b9ac6c0 c35e23e5
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -171,14 +171,13 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
    setDeviceId(mAudioTrack->getRoutedDeviceId());
    mAudioTrack->addAudioDeviceCallback(mDeviceCallback);

    // Update performance mode based on the actual stream.
    // Update performance mode based on the actual stream flags.
    // For example, if the sample rate is not allowed then you won't get a FAST track.
    audio_output_flags_t actualFlags = mAudioTrack->getFlags();
    aaudio_performance_mode_t actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
    if ((actualFlags & (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW))
        == (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW)) {
    // We may not get the RAW flag. But as long as we get the FAST flag we can call it LOW_LATENCY.
    if ((actualFlags & AUDIO_OUTPUT_FLAG_FAST) != 0) {
        actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;

    } else if ((actualFlags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) != 0) {
        actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_POWER_SAVING;
    }