Only allow increasing capture time.

Review URL: http://webrtc-codereview.appspot.com/259001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@861 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2011-11-01 17:10:49 +00:00
parent 18ee6ec8e9
commit 29d75b3f7d
2 changed files with 11 additions and 1 deletions

View File

@ -168,7 +168,8 @@ VideoCaptureImpl::VideoCaptureImpl(const WebRtc_Word32 id)
_lastFrameRateCallbackTime(TickTime::Now()), _frameRateCallBack(false),
_noPictureAlarmCallBack(false), _captureAlarm(Cleared), _setCaptureDelay(0),
_dataCallBack(NULL), _captureCallBack(NULL), _startImageFrameIntervall(0),
_lastProcessFrameCount(TickTime::Now()), _rotateFrame(kRotateNone)
_lastProcessFrameCount(TickTime::Now()), _rotateFrame(kRotateNone),
last_capture_time_(TickTime::MillisecondTimestamp())
{
_requestedCapability.width = kDefaultWidth;
@ -266,6 +267,12 @@ WebRtc_Word32 VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame,
captureFrame.SetRenderTime(TickTime::MillisecondTimestamp());
}
if (captureFrame.RenderTimeMs() == last_capture_time_) {
// We don't allow the same capture time for two frames, drop this one.
return -1;
}
last_capture_time_ = captureFrame.RenderTimeMs();
captureFrame.SetHeight(height);
captureFrame.SetWidth(width);

View File

@ -144,6 +144,9 @@ private:
VideoRotationMode _rotateFrame; //Set if the frame should be rotated by the capture module.
VideoFrame _captureFrame;
// Used to make sure incoming timestamp is increasing for every frame.
WebRtc_Word64 last_capture_time_;
};
} // namespace videocapturemodule
} //namespace webrtc