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

Commit 117752e2 authored by Andy Hung's avatar Andy Hung Committed by Gerrit Code Review
Browse files

Merge "AudioStreamOut: Align with AudioStreamIn" into main

parents 80e08f63 5bbd8eda
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -99,15 +99,15 @@ status_t AudioStreamOut::getPresentationPosition(uint64_t *frames, struct timesp
        return status;
    }

    // Adjust for standby using HAL rate frames.
    // Only apply this correction if the HAL is getting PCM frames.
    if (mHalFormatHasProportionalFrames) {
    if (mHalFormatHasProportionalFrames &&
            (flags & AUDIO_OUTPUT_FLAG_DIRECT) == AUDIO_OUTPUT_FLAG_DIRECT) {
        // For DirectTrack reset timestamp to 0 on standby.
        const uint64_t adjustedPosition = (halPosition <= mFramesWrittenAtStandby) ?
                0 : (halPosition - mFramesWrittenAtStandby);
        // Scale from HAL sample rate to application rate.
        *frames = adjustedPosition / mRateMultiplier;
    } else {
        // For offloaded MP3 and other compressed formats.
        // For offloaded MP3 and other compressed formats, and linear PCM.
        *frames = halPosition;
    }