From d2d7a135396c91b2ff84b578207c2d122ef3eff4 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 5 Jun 2024 13:08:13 -0700 Subject: [PATCH] DO NOT MERGE ANYWHERE: Partial Revert of ag/27467076 for Pixel Roll back the aspect of ag/27467076 ("libaudiohal@aidl: Align position reporting with HIDL") regarding compressed offload streams. The revert is intended for 24D1-release only, it addresses a problem specific to the Pixel audio HAL. The Pixel team is working on a long-term solution for the 24Q3 branch. Reason for revert: b/343334029 Bug: 343334029 Test: repro steps from the bug Test: atest CtsMediaAudioTestCases Change-Id: Icef4429260b0b0360dd7191e76c0d60418b48d7d --- media/libaudiohal/impl/StreamHalAidl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/media/libaudiohal/impl/StreamHalAidl.cpp b/media/libaudiohal/impl/StreamHalAidl.cpp index 5a0edd5e8f..58259d17ff 100644 --- a/media/libaudiohal/impl/StreamHalAidl.cpp +++ b/media/libaudiohal/impl/StreamHalAidl.cpp @@ -686,11 +686,12 @@ status_t StreamOutHalAidl::getRenderPosition(uint64_t *dspFrames) { int64_t mostRecentResetPoint; if (!mContext.isAsynchronous() && audio_has_proportional_frames(mConfig.format)) { mostRecentResetPoint = statePositions.framesAtStandby; + *dspFrames = aidlFrames <= mostRecentResetPoint ? 0 : aidlFrames - mostRecentResetPoint; } else { - mostRecentResetPoint = - std::max(statePositions.framesAtStandby, statePositions.framesAtFlushOrDrain); + // Pixel HAL of 24D1 resets the position on flush/drain for compressed offload streams, + // thus is does not have to be reset here. + *dspFrames = aidlFrames; } - *dspFrames = aidlFrames <= mostRecentResetPoint ? 0 : aidlFrames - mostRecentResetPoint; return OK; }