From cb60fb2e6c229fcf0f2b7db27826e262ba4f268e Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Wed, 24 Apr 2013 23:54:31 +0000 Subject: [PATCH] Make sure timestamps are monotonically increasing. BUG=1563 Review URL: https://webrtc-codereview.appspot.com/1325008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3898 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/video_capture/video_capture_impl.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc index fb0be7997e..b7687749f4 100644 --- a/webrtc/modules/video_capture/video_capture_impl.cc +++ b/webrtc/modules/video_capture/video_capture_impl.cc @@ -194,10 +194,11 @@ int32_t VideoCaptureImpl::DeliverCapturedFrame(I420VideoFrame& captureFrame, } // Set the capture time + const int64_t ntp_time_ms = + Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); int64_t internal_capture_time = TickTime::MillisecondTimestamp(); if (capture_time != 0) { - int64_t time_since_capture = - Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() - capture_time; + int64_t time_since_capture = ntp_time_ms - capture_time; internal_capture_time -= time_since_capture; captureFrame.set_render_time_ms(internal_capture_time); }