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

Commit 0aaff700 authored by Chong Zhang's avatar Chong Zhang
Browse files

skip dropped frame without timestamp checking

also skip frame if timestamp is going backward, instead of crash.

bug: 23191439
Change-Id: I179157bf67bc972b8ebf852d80653daa6e496f1c
parent f271ddd4
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -881,13 +881,6 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs,
        return;
    }

    if (mNumFramesReceived > 0) {
        CHECK(timestampUs > mLastFrameTimestampUs);
        if (timestampUs - mLastFrameTimestampUs > mGlitchDurationThresholdUs) {
            ++mNumGlitches;
        }
    }

    // May need to skip frame or modify timestamp. Currently implemented
    // by the subclass CameraSourceTimeLapse.
    if (skipCurrentFrame(timestampUs)) {
@@ -895,6 +888,18 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs,
        return;
    }

    if (mNumFramesReceived > 0) {
        if (timestampUs <= mLastFrameTimestampUs) {
            ALOGW("Dropping frame with backward timestamp %lld (last %lld)",
                    (long long)timestampUs, (long long)mLastFrameTimestampUs);
            releaseOneRecordingFrame(data);
            return;
        }
        if (timestampUs - mLastFrameTimestampUs > mGlitchDurationThresholdUs) {
            ++mNumGlitches;
        }
    }

    mLastFrameTimestampUs = timestampUs;
    if (mNumFramesReceived == 0) {
        mFirstFrameTimeUs = timestampUs;