summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/CameraSource.cpp
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2015-08-19 14:37:33 -0700
committerChong Zhang <chz@google.com>2015-08-19 14:40:33 -0700
commit0aaff700f6c7885887bbf42f7bb64754e21e5fce (patch)
treebbf9be1e0144fd0889a2198360588a0d3e5fd705 /media/libstagefright/CameraSource.cpp
parentf271ddd4fece6fcdccf3fc2707e35bed66ac4ca1 (diff)
downloadframeworks_av-0aaff700f6c7885887bbf42f7bb64754e21e5fce.zip
frameworks_av-0aaff700f6c7885887bbf42f7bb64754e21e5fce.tar.gz
frameworks_av-0aaff700f6c7885887bbf42f7bb64754e21e5fce.tar.bz2
skip dropped frame without timestamp checking
also skip frame if timestamp is going backward, instead of crash. bug: 23191439 Change-Id: I179157bf67bc972b8ebf852d80653daa6e496f1c
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r--media/libstagefright/CameraSource.cpp19
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;