Diff NTP and internal once in VideoCaptureImpl.
BUG= R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1754004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4285 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
546c91dc2e
commit
504af45a6f
@ -107,17 +107,26 @@ int32_t VideoCaptureImpl::Process()
|
||||
}
|
||||
|
||||
VideoCaptureImpl::VideoCaptureImpl(const int32_t id)
|
||||
: _id(id), _deviceUniqueId(NULL), _apiCs(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_captureDelay(0), _requestedCapability(),
|
||||
: _id(id),
|
||||
_deviceUniqueId(NULL),
|
||||
_apiCs(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_captureDelay(0),
|
||||
_requestedCapability(),
|
||||
_callBackCs(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_lastProcessTime(TickTime::Now()),
|
||||
_lastFrameRateCallbackTime(TickTime::Now()), _frameRateCallBack(false),
|
||||
_noPictureAlarmCallBack(false), _captureAlarm(Cleared), _setCaptureDelay(0),
|
||||
_dataCallBack(NULL), _captureCallBack(NULL),
|
||||
_lastProcessFrameCount(TickTime::Now()), _rotateFrame(kRotateNone),
|
||||
last_capture_time_(TickTime::MillisecondTimestamp())
|
||||
|
||||
{
|
||||
_lastFrameRateCallbackTime(TickTime::Now()),
|
||||
_frameRateCallBack(false),
|
||||
_noPictureAlarmCallBack(false),
|
||||
_captureAlarm(Cleared),
|
||||
_setCaptureDelay(0),
|
||||
_dataCallBack(NULL),
|
||||
_captureCallBack(NULL),
|
||||
_lastProcessFrameCount(TickTime::Now()),
|
||||
_rotateFrame(kRotateNone),
|
||||
last_capture_time_(TickTime::MillisecondTimestamp()),
|
||||
delta_ntp_internal_ms_(
|
||||
Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() -
|
||||
TickTime::MillisecondTimestamp()) {
|
||||
_requestedCapability.width = kDefaultWidth;
|
||||
_requestedCapability.height = kDefaultHeight;
|
||||
_requestedCapability.maxFPS = 30;
|
||||
@ -194,16 +203,14 @@ 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 = ntp_time_ms - capture_time;
|
||||
internal_capture_time -= time_since_capture;
|
||||
captureFrame.set_render_time_ms(internal_capture_time);
|
||||
}
|
||||
else {
|
||||
captureFrame.set_render_time_ms(internal_capture_time);
|
||||
int64_t internal_capture_time = TickTime::MillisecondTimestamp();
|
||||
int64_t ntp_time_ms = internal_capture_time + delta_ntp_internal_ms_;
|
||||
int64_t time_since_capture = ntp_time_ms - capture_time;
|
||||
internal_capture_time -= time_since_capture;
|
||||
captureFrame.set_render_time_ms(internal_capture_time);
|
||||
} else {
|
||||
captureFrame.set_render_time_ms(TickTime::MillisecondTimestamp());
|
||||
}
|
||||
|
||||
TRACE_EVENT1("webrtc", "VC::DeliverCapturedFrame",
|
||||
|
@ -132,7 +132,10 @@ private:
|
||||
|
||||
// Used to make sure incoming timestamp is increasing for every frame.
|
||||
int64_t last_capture_time_;
|
||||
|
||||
// Delta used for translating between NTP and internal timestamps.
|
||||
const int64_t delta_ntp_internal_ms_;
|
||||
};
|
||||
} // namespace videocapturemodule
|
||||
} //namespace webrtc
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user