From 05fc6aa383649152c6ea223c21d8ff7e643aa0fc Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 11 Oct 2024 13:55:54 -0700 Subject: [PATCH] audio: Fix AudioRecordTest#testTimestamp CTS on CF After experimenting, it seems that the input poll is more stable after the PCM input on CF has just been opened. Since calling 'flush' on an input stream puts it into the 'STANDBY' state, explicitly call 'StreamAlsa::standby' after 'flush' in the primary input stream implementation. Bug: 340899868 Bug: 362852052 Bug: 372951987 Test: atest CtsMediaAudioTestCases Test: atest VtsHalAudioCoreTargetTest Change-Id: Ic1df6835ce00323ca3f0905ea46d3bc151e05fc4 --- audio/aidl/default/primary/StreamPrimary.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/audio/aidl/default/primary/StreamPrimary.cpp b/audio/aidl/default/primary/StreamPrimary.cpp index 1176d05316..c1c1f03974 100644 --- a/audio/aidl/default/primary/StreamPrimary.cpp +++ b/audio/aidl/default/primary/StreamPrimary.cpp @@ -56,7 +56,9 @@ StreamPrimary::StreamPrimary(StreamContext* context, const Metadata& metadata) } ::android::status_t StreamPrimary::flush() { - return isStubStreamOnWorker() ? mStubDriver.flush() : StreamAlsa::flush(); + RETURN_STATUS_IF_ERROR(isStubStreamOnWorker() ? mStubDriver.flush() : StreamAlsa::flush()); + // TODO(b/372951987): consider if this needs to be done from 'StreamInWorkerLogic::cycle'. + return mIsInput ? standby() : ::android::OK; } ::android::status_t StreamPrimary::pause() {