diff options
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index bc34bcf..66280da 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -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; |