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

Commit 75563d32 authored by Mingyu Shih's avatar Mingyu Shih Committed by Lin Lili
Browse files

Fix cts fail AudioTrackTest#testPlaybackHeadPositionIncrease

When property audio.deep_buffer.media is true, the deep buffer flag should be added if getOutput() parameter is music stream for getting correct track buffer size.

Bug: 285222536
Test: adb shell "am instrument -e class android.media.audio.cts.AudioTrackTest#testPlaybackHeadPositionIncrease -w -r android.media.audio.cts/androidx.test.runner.AndroidJUnitRunner"
Change-Id: I896a9b1807ec6ae512344d8a1e3e681806bbff22
parent 9eb3b47e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1088,7 +1088,12 @@ audio_io_handle_t AudioPolicyManager::getOutput(audio_stream_type_t stream)
    // and AudioSystem::getOutputSamplingRate().

    SortedVector<audio_io_handle_t> outputs = getOutputsForDevices(devices, mOutputs);
    const audio_io_handle_t output = selectOutput(outputs);
    audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
    if (stream == AUDIO_STREAM_MUSIC &&
        property_get_bool("audio.deep_buffer.media", false /* default_value */)) {
        flags = AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
    }
    const audio_io_handle_t output = selectOutput(outputs, flags);

    ALOGV("getOutput() stream %d selected devices %s, output %d", stream,
          devices.toString().c_str(), output);