Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: webrtc/modules/video_capture/video_capture_impl.cc

Issue 1888593004: Delete all use of tick_util.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_capture/video_capture_impl.cc
diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc
index b1e697edc22eae7b21bfbc306d5e550c54bceebe..f5b845b4f9c01d57185a2c2e59c8c28f8ffb8178 100644
--- a/webrtc/modules/video_capture/video_capture_impl.cc
+++ b/webrtc/modules/video_capture/video_capture_impl.cc
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include "webrtc/base/refcount.h"
+#include "webrtc/base/timeutils.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/include/module_common_types.h"
@@ -20,7 +21,6 @@
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/logging.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
namespace webrtc {
namespace videocapturemodule {
@@ -85,7 +85,7 @@ int64_t VideoCaptureImpl::TimeUntilNextProcess()
CriticalSectionScoped cs(&_callBackCs);
const int64_t kProcessIntervalMs = 300;
return kProcessIntervalMs -
- (TickTime::Now() - _lastProcessTime).Milliseconds();
+ (rtc::TimeNanos() - _lastProcessTime) / rtc::kNumNanosecsPerMillisec;
}
// Process any pending tasks such as timeouts
@@ -93,12 +93,12 @@ void VideoCaptureImpl::Process()
{
CriticalSectionScoped cs(&_callBackCs);
- const TickTime now = TickTime::Now();
- _lastProcessTime = TickTime::Now();
+ const int64_t now = rtc::TimeNanos();
+ _lastProcessTime = rtc::TimeNanos();
stefan-webrtc 2016/04/19 09:19:12 Units
nisse-webrtc 2016/04/19 12:19:25 Done.
// Handle No picture alarm
- if (_lastProcessFrameCount.Ticks() == _incomingFrameTimes[0].Ticks() &&
+ if (_lastProcessFrameCount == _incomingFrameTimes[0] &&
_captureAlarm != Raised)
{
if (_noPictureAlarmCallBack && _captureCallBack)
@@ -107,7 +107,7 @@ void VideoCaptureImpl::Process()
_captureCallBack->OnNoPictureAlarm(_id, _captureAlarm);
}
}
- else if (_lastProcessFrameCount.Ticks() != _incomingFrameTimes[0].Ticks() &&
+ else if (_lastProcessFrameCount != _incomingFrameTimes[0] &&
_captureAlarm != Cleared)
{
if (_noPictureAlarmCallBack && _captureCallBack)
@@ -119,7 +119,7 @@ void VideoCaptureImpl::Process()
}
// Handle frame rate callback
- if ((now - _lastFrameRateCallbackTime).Milliseconds()
+ if ((now - _lastFrameRateCallbackTime) / rtc::kNumNanosecsPerMillisec
> kFrameRateCallbackInterval)
{
if (_frameRateCallBack && _captureCallBack)
@@ -141,15 +141,15 @@ VideoCaptureImpl::VideoCaptureImpl(const int32_t id)
_captureDelay(0),
_requestedCapability(),
_callBackCs(*CriticalSectionWrapper::CreateCriticalSection()),
- _lastProcessTime(TickTime::Now()),
- _lastFrameRateCallbackTime(TickTime::Now()),
+ _lastProcessTime(rtc::TimeNanos()),
+ _lastFrameRateCallbackTime(rtc::TimeNanos()),
_frameRateCallBack(false),
_noPictureAlarmCallBack(false),
_captureAlarm(Cleared),
_setCaptureDelay(0),
_dataCallBack(NULL),
_captureCallBack(NULL),
- _lastProcessFrameCount(TickTime::Now()),
+ _lastProcessFrameCount(rtc::TimeNanos()),
_rotateFrame(kVideoRotation_0),
apply_rotation_(false) {
_requestedCapability.width = kDefaultWidth;
@@ -295,7 +295,7 @@ int32_t VideoCaptureImpl::IncomingFrame(
_captureFrame.set_rotation(kVideoRotation_0);
}
_captureFrame.set_ntp_time_ms(captureTime);
- _captureFrame.set_render_time_ms(TickTime::MillisecondTimestamp());
+ _captureFrame.set_render_time_ms(rtc::Time64());
DeliverCapturedFrame(_captureFrame);
}
@@ -321,7 +321,7 @@ void VideoCaptureImpl::EnableFrameRateCallback(const bool enable) {
_frameRateCallBack = enable;
if (enable)
{
- _lastFrameRateCallbackTime = TickTime::Now();
+ _lastFrameRateCallbackTime = rtc::TimeNanos();
}
}
@@ -341,7 +341,7 @@ void VideoCaptureImpl::EnableNoPictureAlarm(const bool enable) {
void VideoCaptureImpl::UpdateFrameCount()
{
- if (_incomingFrameTimes[0].MicrosecondTimestamp() == 0)
+ if (_incomingFrameTimes[0] / rtc::kNumNanosecsPerMicrosec == 0)
{
// first no shift
}
@@ -353,17 +353,18 @@ void VideoCaptureImpl::UpdateFrameCount()
_incomingFrameTimes[i + 1] = _incomingFrameTimes[i];
}
}
- _incomingFrameTimes[0] = TickTime::Now();
+ _incomingFrameTimes[0] = rtc::TimeNanos();
}
-uint32_t VideoCaptureImpl::CalculateFrameRate(const TickTime& now)
+uint32_t VideoCaptureImpl::CalculateFrameRate(int64_t now_ns)
{
int32_t num = 0;
int32_t nrOfFrames = 0;
for (num = 1; num < (kFrameRateCountHistorySize - 1); num++)
{
- if (_incomingFrameTimes[num].Ticks() <= 0
- || (now - _incomingFrameTimes[num]).Milliseconds() > kFrameRateHistoryWindowMs) // don't use data older than 2sec
+ if (_incomingFrameTimes[num] <= 0 ||
+ (now_ns - _incomingFrameTimes[num]) / rtc::kNumNanosecsPerMillisec >
+ kFrameRateHistoryWindowMs) // don't use data older than 2sec
{
break;
}
@@ -374,7 +375,8 @@ uint32_t VideoCaptureImpl::CalculateFrameRate(const TickTime& now)
}
if (num > 1)
{
- int64_t diff = (now - _incomingFrameTimes[num - 1]).Milliseconds();
+ int64_t diff = (now_ns - _incomingFrameTimes[num - 1]) /
+ rtc::kNumNanosecsPerMillisec;
if (diff > 0)
{
return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f);

Powered by Google App Engine
This is Rietveld 408576698