diff options
author | Andy Hung <hunga@google.com> | 2024-02-28 23:32:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-02-28 23:32:13 +0000 |
commit | 117752e26cc84deffafa6970585f82cee791828e (patch) | |
tree | ce9953e97614faf5cc04c3ff978f74f7c60c35ad | |
parent | 80e08f6368b3bb5095be5637028a472f906bc5eb (diff) | |
parent | 5bbd8eda9d27f6afb5e7fc68f5708cfe8eb5d202 (diff) | |
download | av-117752e26cc84deffafa6970585f82cee791828e.tar.gz |
Merge "AudioStreamOut: Align with AudioStreamIn" into main
-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; } |