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

Commit cbe655e7 authored by Phil Burk's avatar Phil Burk Committed by Android Git Automerger
Browse files

am 93927035: Merge "AudioTrack: reduce retrograde motion spew" into mnc-dev

* commit '93927035':
  AudioTrack: reduce retrograde motion spew
parents d3c388fd 93927035
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -839,6 +839,7 @@ protected:
                                                    // only used for offloaded and direct tracks.

    bool                    mPreviousTimestampValid;// true if mPreviousTimestamp is valid
    bool                    mRetrogradeMotionReported; // reduce log spam
    AudioTimestamp          mPreviousTimestamp;     // used to detect retrograde motion

    audio_output_flags_t    mFlags;
+12 −5
Original line number Diff line number Diff line
@@ -2227,11 +2227,18 @@ status_t AudioTrack::getTimestamp(AudioTimestamp& timestamp)
                    - mPreviousTimestamp.mPosition);
            // position can bobble slightly as an artifact; this hides the bobble
            static const int32_t MINIMUM_POSITION_DELTA = 8;
            ALOGW_IF(deltaPosition < 0,
                    "retrograde timestamp position corrected, %d = %u - %u",
            if (deltaPosition < 0) {
                // Only report once per position instead of spamming the log.
                if (!mRetrogradeMotionReported) {
                    ALOGW("retrograde timestamp position corrected, %d = %u - %u",
                            deltaPosition,
                            timestamp.mPosition,
                            mPreviousTimestamp.mPosition);
                    mRetrogradeMotionReported = true;
                }
            } else {
                mRetrogradeMotionReported = false;
            }
            if (deltaPosition < MINIMUM_POSITION_DELTA) {
                timestamp = mPreviousTimestamp;  // Use last valid timestamp.
            }