Chromium Code Reviews| Index: webrtc/modules/video_capture/test/video_capture_unittest.cc |
| diff --git a/webrtc/modules/video_capture/test/video_capture_unittest.cc b/webrtc/modules/video_capture/test/video_capture_unittest.cc |
| index 7ab33ffeaba4f7b49af923652183a488a6b9bae8..30e765aa37138ea6cd682d881186b19ab1433191 100644 |
| --- a/webrtc/modules/video_capture/test/video_capture_unittest.cc |
| +++ b/webrtc/modules/video_capture/test/video_capture_unittest.cc |
| @@ -16,19 +16,18 @@ |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "webrtc/base/scoped_ref_ptr.h" |
| +#include "webrtc/base/timeutils.h" |
| #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| #include "webrtc/modules/utility/include/process_thread.h" |
| #include "webrtc/modules/video_capture/video_capture.h" |
| #include "webrtc/modules/video_capture/video_capture_factory.h" |
| #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| #include "webrtc/system_wrappers/include/sleep.h" |
| -#include "webrtc/system_wrappers/include/tick_util.h" |
| #include "webrtc/video_frame.h" |
| using webrtc::CriticalSectionWrapper; |
| using webrtc::CriticalSectionScoped; |
| using webrtc::SleepMs; |
| -using webrtc::TickTime; |
| using webrtc::VideoCaptureAlarm; |
| using webrtc::VideoCaptureCapability; |
| using webrtc::VideoCaptureDataCallback; |
| @@ -40,8 +39,8 @@ using webrtc::VideoCaptureModule; |
| #define WAIT_(ex, timeout, res) \ |
| do { \ |
| res = (ex); \ |
| - int64_t start = TickTime::MillisecondTimestamp(); \ |
| - while (!res && TickTime::MillisecondTimestamp() < start + timeout) { \ |
| + int64_t start = rtc::Time64(); \ |
| + while (!res && rtc::Time64() < start + timeout) { \ |
| SleepMs(5); \ |
| res = (ex); \ |
| } \ |
| @@ -118,8 +117,8 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback { |
| #endif |
| // RenderTimstamp should be the time now. |
| EXPECT_TRUE( |
| - videoFrame.render_time_ms() >= TickTime::MillisecondTimestamp()-30 && |
| - videoFrame.render_time_ms() <= TickTime::MillisecondTimestamp()); |
| + videoFrame.render_time_ms() >= rtc::Time64()-30 && |
| + videoFrame.render_time_ms() <= rtc::Time64()); |
| if ((videoFrame.render_time_ms() > |
| last_render_time_ms_ + (1000 * 1.1) / capability_.maxFPS && |
| @@ -277,7 +276,7 @@ class VideoCaptureTest : public testing::Test { |
| #endif |
| TEST_F(VideoCaptureTest, MAYBE_CreateDelete) { |
| for (int i = 0; i < 5; ++i) { |
| - int64_t start_time = TickTime::MillisecondTimestamp(); |
| + int64_t start_time = rtc::Time64(); |
| TestVideoCaptureCallback capture_observer; |
| rtc::scoped_refptr<VideoCaptureModule> module( |
| OpenVideoCaptureDevice(0, &capture_observer)); |
| @@ -296,19 +295,19 @@ TEST_F(VideoCaptureTest, MAYBE_CreateDelete) { |
| ASSERT_NO_FATAL_FAILURE(StartCapture(module.get(), capability)); |
| // Less than 4s to start the camera. |
| - EXPECT_LE(TickTime::MillisecondTimestamp() - start_time, 4000); |
| + EXPECT_LE(rtc::Time64() - start_time, 4000); |
| // Make sure 5 frames are captured. |
| EXPECT_TRUE_WAIT(capture_observer.incoming_frames() >= 5, kTimeOut); |
| EXPECT_GE(capture_observer.capture_delay(), 0); |
| - int64_t stop_time = TickTime::MillisecondTimestamp(); |
| + int64_t stop_time = rtc::Time64(); |
| EXPECT_EQ(0, module->StopCapture()); |
| EXPECT_FALSE(module->CaptureStarted()); |
| // Less than 3s to stop the camera. |
| - EXPECT_LE(TickTime::MillisecondTimestamp() - stop_time, 3000); |
| + EXPECT_LE(rtc::Time64() - stop_time, 3000); |
| } |
| } |
| @@ -494,9 +493,11 @@ TEST_F(VideoCaptureExternalTest, TestExternalCapture) { |
| #endif |
| TEST_F(VideoCaptureExternalTest, MAYBE_FrameRate) { |
| int64_t testTime = 3; |
| - TickTime startTime = TickTime::Now(); |
| + int64_t startTime = rtc::TimeNanos(); |
|
stefan-webrtc
2016/04/19 09:19:12
Seems like startTime should be the same type as re
nisse-webrtc
2016/04/19 12:19:25
Done. Typing seem a bit confused, TimeNanos and Ti
stefan-webrtc
2016/04/19 12:40:47
Do you think there's a reason to return uint64_t f
nisse-webrtc
2016/04/19 13:48:50
I don't have a strong opinion here. Changing retur
|
| - while ((TickTime::Now() - startTime).Milliseconds() < testTime * 1000) { |
| + while ((static_cast<int64_t>(rtc::TimeNanos()) - startTime) / |
| + rtc::kNumNanosecsPerMillisec < |
| + testTime * 1000) { |
| size_t length = webrtc::CalcBufferSize(webrtc::kI420, |
| test_frame_.width(), |
| test_frame_.height()); |
| @@ -511,8 +512,10 @@ TEST_F(VideoCaptureExternalTest, MAYBE_FrameRate) { |
| SleepMs(500); |
| EXPECT_EQ(webrtc::Raised, capture_feedback_.alarm()); |
| - startTime = TickTime::Now(); |
| - while ((TickTime::Now() - startTime).Milliseconds() < testTime * 1000) { |
| + startTime = rtc::TimeNanos(); |
| + while ((static_cast<int64_t>(rtc::TimeNanos()) - startTime) / |
| + rtc::kNumNanosecsPerMillisec < |
| + testTime * 1000) { |
| size_t length = webrtc::CalcBufferSize(webrtc::kI420, |
| test_frame_.width(), |
| test_frame_.height()); |