Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 743f6403 authored by Andy Hung's avatar Andy Hung
Browse files

AudioFlinger: Fix read timestamp if HAL returns error

Test: android.media.cts.AudioRecordTest#testTimestamp
Bug: 158112444
Change-Id: Ibb35c6247ab94e63d586eddd1c95b7fc186e7822
parent 4e48c247
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -7366,8 +7366,10 @@ reacquire_wakelock:

        // Update server timestamp with server stats
        // systemTime() is optional if the hardware supports timestamps.
        if (framesRead >= 0) {
            mTimestamp.mPosition[ExtendedTimestamp::LOCATION_SERVER] += framesRead;
            mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_SERVER] = lastIoEndNs;
        }

        // Update server timestamp with kernel stats
        if (mPipeSource.get() == nullptr /* don't obtain for FastCapture, could block */) {