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

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

AudioTrack: Reject offloading for non-music streams

Reject AudioTrack initialization if called with non-music
stream type (or attribute) but with AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD.

This will allow the client to fall back to SW decode or
deal with the error appropriately.

CRs-Fixed: 740607
Change-Id: I4d1dda6523bd792ab26b0363e16febcd14b1ad98
parent ecc16eae
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -379,6 +379,10 @@ status_t AudioTrack::set(
    // only allow deep buffering for music stream type
    if (mStreamType != AUDIO_STREAM_MUSIC) {
        flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
        if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
            ALOGE("Offloading only allowed with music stream");
            return BAD_VALUE; // To trigger fallback or let the client handle
        }
    }

#ifdef QCOM_HARDWARE