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

Commit c272efca authored by Andy Hung's avatar Andy Hung Committed by android-build-merger
Browse files

Merge "AudioFlinger: Do not permit fast patch tracks if not compatible" into qt-dev am: 432e0fd4

am: 0a1c618d

Change-Id: Ibc7421cb149580cdb9a4ab6a31f805d4828b01e8
parents 6800429e 0a1c618d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -827,6 +827,12 @@ sp<IAudioTrack> AudioFlinger::createTrack(const CreateTrackInput& input,
                    ALOGE("Secondary output patchRecord init failed: %d", status);
                    continue;
                }

                // TODO: We could check compatibility of the secondaryThread with the PatchTrack
                // for fast usage: thread has fast mixer, sample rate matches, etc.;
                // for now, we exclude fast tracks by removing the Fast flag.
                const audio_output_flags_t outputFlags =
                        (audio_output_flags_t)(output.flags & ~AUDIO_OUTPUT_FLAG_FAST);
                sp patchTrack = new PlaybackThread::PatchTrack(secondaryThread,
                                                               streamType,
                                                               output.sampleRate,
@@ -835,7 +841,7 @@ sp<IAudioTrack> AudioFlinger::createTrack(const CreateTrackInput& input,
                                                               frameCount,
                                                               patchRecord->buffer(),
                                                               patchRecord->bufferSize(),
                                                               output.flags,
                                                               outputFlags,
                                                               0ns /* timeout */);
                status = patchTrack->initCheck();
                if (status != NO_ERROR) {
+3 −0
Original line number Diff line number Diff line
@@ -506,7 +506,10 @@ status_t AudioFlinger::PatchPanel::Patch::createConnections(PatchPanel *panel)
    }
    if (mPlayback.thread()->hasFastMixer()) {
        // Create a fast track if the playback thread has fast mixer to get better performance.
        // Note: we should have matching channel mask, sample rate, and format by the logic above.
        outputFlags = (audio_output_flags_t) (outputFlags | AUDIO_OUTPUT_FLAG_FAST);
    } else {
        outputFlags = (audio_output_flags_t) (outputFlags & ~AUDIO_OUTPUT_FLAG_FAST);
    }

    // create a special playback track to render to playback thread.
+4 −0
Original line number Diff line number Diff line
@@ -4618,6 +4618,10 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac

        // process fast tracks
        if (track->isFastTrack()) {
            LOG_ALWAYS_FATAL_IF(mFastMixer.get() == nullptr,
                    "%s(%d): FastTrack(%d) present without FastMixer",
                     __func__, id(), track->id());

            if (track->getHapticPlaybackEnabled()) {
                noFastHapticTrack = false;
            }