summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2024-02-28 23:32:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-02-28 23:32:13 +0000
commit117752e26cc84deffafa6970585f82cee791828e (patch)
treece9953e97614faf5cc04c3ff978f74f7c60c35ad
parent80e08f6368b3bb5095be5637028a472f906bc5eb (diff)
parent5bbd8eda9d27f6afb5e7fc68f5708cfe8eb5d202 (diff)
downloadav-117752e26cc84deffafa6970585f82cee791828e.tar.gz
Merge "AudioStreamOut: Align with AudioStreamIn" into main
-rw-r--r--services/audioflinger/datapath/AudioStreamOut.cpp8
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;
}