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

Commit d3639927 authored by Andy Hung's avatar Andy Hung
Browse files

AudioFlinger: Unify spatializer behavior with normal mixer thread

Test: Basic playback
Bug: 230799946
Change-Id: I6de2cb672b65f4d1223b3a11e7c4a38ee0e857b4
parent 4b7f54f7
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -3008,6 +3008,7 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l()

    // Calculate size of normal sink buffer relative to the HAL output buffer size
    double multiplier = 1.0;
    // Note: mType == SPATIALIZER does not support FastMixer.
    if (mType == MIXER && (kUseFastMixer == FastMixer_Static ||
            kUseFastMixer == FastMixer_Dynamic)) {
        size_t minNormalFrameCount = (kMinNormalSinkBufferSizeMs * mSampleRate) / 1000;
@@ -3695,7 +3696,7 @@ bool AudioFlinger::PlaybackThread::threadLoop()
    cacheParameters_l();
    mSleepTimeUs = mIdleSleepTimeUs;

    if (mType == MIXER) {
    if (mType == MIXER || mType == SPATIALIZER) {
        sleepTimeShift = 0;
    }

@@ -3873,7 +3874,7 @@ bool AudioFlinger::PlaybackThread::threadLoop()

                    mStandbyTimeNs = systemTime() + mStandbyDelayNs;
                    mSleepTimeUs = mIdleSleepTimeUs;
                    if (mType == MIXER) {
                    if (mType == MIXER || mType == SPATIALIZER) {
                        sleepTimeShift = 0;
                    }

@@ -4150,7 +4151,8 @@ bool AudioFlinger::PlaybackThread::threadLoop()

                            // write blocked detection
                            const int64_t deltaWriteNs = lastIoEndNs - lastIoBeginNs;
                            if (mType == MIXER && deltaWriteNs > maxPeriod) {
                            if ((mType == MIXER || mType == SPATIALIZER)
                                    && deltaWriteNs > maxPeriod) {
                                mNumDelayedWrites++;
                                if ((lastIoEndNs - lastWarning) > kWarningThrottleNs) {
                                    ATRACE_NAME("underrun");
@@ -4171,7 +4173,7 @@ bool AudioFlinger::PlaybackThread::threadLoop()
                        (mMixerStatus == MIXER_DRAIN_ALL)) {
                    threadLoop_drain();
                }
                if (mType == MIXER && !mStandby) {
                if ((mType == MIXER || mType == SPATIALIZER) && !mStandby) {

                    if (mThreadThrottle
                            && mMixerStatus == MIXER_TRACKS_READY // we are mixing (active tracks)