diff options
author | Andy Hung <hunga@google.com> | 2024-02-20 13:57:02 -0800 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2024-02-28 12:39:41 -0800 |
commit | 5bbd8eda9d27f6afb5e7fc68f5708cfe8eb5d202 (patch) | |
tree | 9304392d4fda291f22e5b7205f9776fdbebe0925 | |
parent | 0c5d37c0fdd82fee0f975264acdde63b79e9c40a (diff) | |
download | av-5bbd8eda9d27f6afb5e7fc68f5708cfe8eb5d202.tar.gz |
AudioStreamOut: Align with AudioStreamIn
Currenty the MixerThread bypasses AudioStreamOut::getPresentationPosition so
inaccuracy in handling is avoided. Fix this to work for the linear PCM
case.
Test: atest AudioTrackTest (with and without AudioStreamOut usage)
Bug: 326134469
Merged-In: I630d1e79bd591e6ce5e99ccec1df094e989be2f1
Change-Id: I630d1e79bd591e6ce5e99ccec1df094e989be2f1
-rw-r--r-- | services/audioflinger/datapath/AudioStreamOut.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/audioflinger/datapath/AudioStreamOut.cpp b/services/audioflinger/datapath/AudioStreamOut.cpp index 1830d15cc5..9851f3a00d 100644 --- a/services/audioflinger/datapath/AudioStreamOut.cpp +++ b/services/audioflinger/datapath/AudioStreamOut.cpp @@ -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; } |