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

Commit beaf7aff authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Steve Kondik
Browse files

AudioOutput: Always open AudioTrack with a flag

If the client of AudioOutput calls open with AUDIO_OUTPUT_FLAG_NONE,
change it to AUDIO_OUTPUT_FLAG_PRIMARY. This is to prevent unintended
track offload.

CRs-Fixed: 860943
Change-Id: I6d3cfe106a1c04330a17beb04f9c59f44c5e797d
parent ba0017c4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1702,6 +1702,14 @@ status_t MediaPlayerService::AudioOutput::open(
        return BAD_VALUE;
    }

    // a non null offloadInfo might mean some other flags
    // are set.
    if (offloadInfo == NULL) {
        if (flags == AUDIO_OUTPUT_FLAG_NONE) {
            flags = AUDIO_OUTPUT_FLAG_PRIMARY;
        }
    }

    if ((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0) {
        frameCount = 0; // AudioTrack will get frame count from AudioFlinger
    } else {