Move video_coding to new Clock interface and remove fake clock implementations from RTP module tests.
TEST=video_coding_unittests, video_coding_integrationtests, rtp_rtcp_unittests, trybots
Review URL: https://webrtc-codereview.appspot.com/1044004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3393 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.cc b/webrtc/modules/video_coding/main/source/generic_decoder.cc
index 3139ba8..a9bb763 100644
--- a/webrtc/modules/video_coding/main/source/generic_decoder.cc
+++ b/webrtc/modules/video_coding/main/source/generic_decoder.cc
@@ -12,12 +12,12 @@
#include "trace.h"
#include "generic_decoder.h"
#include "internal_defines.h"
-#include "tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc {
VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing,
- TickTimeBase* clock)
+ Clock* clock)
:
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
_clock(clock),
@@ -56,7 +56,7 @@
_timing.StopDecodeTimer(
decodedImage.timestamp(),
frameInfo->decodeStartTimeMs,
- _clock->MillisecondTimestamp());
+ _clock->TimeInMilliseconds());
if (_receiveCallback != NULL)
{
diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.h b/webrtc/modules/video_coding/main/source/generic_decoder.h
index 016142a..084bd76 100644
--- a/webrtc/modules/video_coding/main/source/generic_decoder.h
+++ b/webrtc/modules/video_coding/main/source/generic_decoder.h
@@ -34,7 +34,7 @@
class VCMDecodedFrameCallback : public DecodedImageCallback
{
public:
- VCMDecodedFrameCallback(VCMTiming& timing, TickTimeBase* clock);
+ VCMDecodedFrameCallback(VCMTiming& timing, Clock* clock);
virtual ~VCMDecodedFrameCallback();
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
@@ -49,7 +49,7 @@
private:
CriticalSectionWrapper* _critSect;
- TickTimeBase* _clock;
+ Clock* _clock;
I420VideoFrame _frame;
VCMReceiveCallback* _receiveCallback;
VCMTiming& _timing;
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.cc b/webrtc/modules/video_coding/main/source/jitter_buffer.cc
index c80b84a..8121497 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer.cc
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer.cc
@@ -12,16 +12,16 @@
#include <algorithm>
#include <cassert>
-#include "modules/video_coding/main/source/event.h"
-#include "modules/video_coding/main/source/frame_buffer.h"
-#include "modules/video_coding/main/source/inter_frame_delay.h"
-#include "modules/video_coding/main/source/internal_defines.h"
-#include "modules/video_coding/main/source/jitter_buffer_common.h"
-#include "modules/video_coding/main/source/jitter_estimator.h"
-#include "modules/video_coding/main/source/packet.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
-#include "system_wrappers/interface/critical_section_wrapper.h"
-#include "system_wrappers/interface/trace.h"
+#include "webrtc/modules/video_coding/main/source/event.h"
+#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
+#include "webrtc/modules/video_coding/main/source/inter_frame_delay.h"
+#include "webrtc/modules/video_coding/main/source/internal_defines.h"
+#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.h"
+#include "webrtc/modules/video_coding/main/source/jitter_estimator.h"
+#include "webrtc/modules/video_coding/main/source/packet.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@@ -61,7 +61,7 @@
}
};
-VCMJitterBuffer::VCMJitterBuffer(TickTimeBase* clock,
+VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
int vcm_id,
int receiver_id,
bool master)
@@ -90,7 +90,7 @@
num_consecutive_old_packets_(0),
num_discarded_packets_(0),
jitter_estimate_(vcm_id, receiver_id),
- inter_frame_delay_(clock_->MillisecondTimestamp()),
+ inter_frame_delay_(clock_->TimeInMilliseconds()),
rtt_ms_(kDefaultRtt),
nack_mode_(kNoNack),
low_rtt_nack_threshold_ms_(-1),
@@ -177,7 +177,7 @@
incoming_frame_rate_ = 0;
incoming_bit_count_ = 0;
incoming_bit_rate_ = 0;
- time_last_incoming_frame_count_ = clock_->MillisecondTimestamp();
+ time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
memset(receive_statistics_, 0, sizeof(receive_statistics_));
num_consecutive_old_frames_ = 0;
@@ -241,7 +241,7 @@
num_consecutive_old_packets_ = 0;
// Also reset the jitter and delay estimates
jitter_estimate_.Reset();
- inter_frame_delay_.Reset(clock_->MillisecondTimestamp());
+ inter_frame_delay_.Reset(clock_->TimeInMilliseconds());
waiting_for_completion_.frame_size = 0;
waiting_for_completion_.timestamp = 0;
waiting_for_completion_.latest_packet_time = -1;
@@ -278,7 +278,7 @@
assert(framerate);
assert(bitrate);
CriticalSectionScoped cs(crit_sect_);
- const int64_t now = clock_->MillisecondTimestamp();
+ const int64_t now = clock_->TimeInMilliseconds();
int64_t diff = now - time_last_incoming_frame_count_;
if (diff < 1000 && incoming_frame_rate_ > 0 && incoming_bit_rate_ > 0) {
// Make sure we report something even though less than
@@ -323,7 +323,7 @@
} else {
// No frames since last call
- time_last_incoming_frame_count_ = clock_->MillisecondTimestamp();
+ time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
*framerate = 0;
bitrate = 0;
incoming_bit_rate_ = 0;
@@ -437,8 +437,8 @@
crit_sect_->Leave();
return NULL;
}
- const int64_t end_wait_time_ms = clock_->MillisecondTimestamp()
- + max_wait_time_ms;
+ const int64_t end_wait_time_ms = clock_->TimeInMilliseconds() +
+ max_wait_time_ms;
int64_t wait_time_ms = max_wait_time_ms;
while (wait_time_ms > 0) {
crit_sect_->Leave();
@@ -457,8 +457,7 @@
CleanUpOldFrames();
it = FindOldestCompleteContinuousFrame(false);
if (it == frame_list_.end()) {
- wait_time_ms = end_wait_time_ms -
- clock_->MillisecondTimestamp();
+ wait_time_ms = end_wait_time_ms - clock_->TimeInMilliseconds();
} else {
break;
}
@@ -663,7 +662,7 @@
const VCMPacket& packet) {
assert(encoded_frame);
CriticalSectionScoped cs(crit_sect_);
- int64_t now_ms = clock_->MillisecondTimestamp();
+ int64_t now_ms = clock_->TimeInMilliseconds();
VCMFrameBufferEnum buffer_return = kSizeError;
VCMFrameBufferEnum ret = kSizeError;
VCMFrameBuffer* frame = static_cast<VCMFrameBuffer*>(encoded_frame);
@@ -673,7 +672,7 @@
if (first_packet_) {
// Now it's time to start estimating jitter
// reset the delay estimate.
- inter_frame_delay_.Reset(clock_->MillisecondTimestamp());
+ inter_frame_delay_.Reset(clock_->TimeInMilliseconds());
first_packet_ = false;
}
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.h b/webrtc/modules/video_coding/main/source/jitter_buffer.h
index 5b30fb8..d0a2569 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer.h
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer.h
@@ -35,7 +35,7 @@
typedef std::list<VCMFrameBuffer*> FrameList;
// forward declarations
-class TickTimeBase;
+class Clock;
class VCMFrameBuffer;
class VCMPacket;
class VCMEncodedFrame;
@@ -49,7 +49,7 @@
class VCMJitterBuffer {
public:
- VCMJitterBuffer(TickTimeBase* clock, int vcm_id = -1, int receiver_id = -1,
+ VCMJitterBuffer(Clock* clock, int vcm_id = -1, int receiver_id = -1,
bool master = true);
virtual ~VCMJitterBuffer();
@@ -206,7 +206,7 @@
int vcm_id_;
int receiver_id_;
- TickTimeBase* clock_;
+ Clock* clock_;
// If we are running (have started) or not.
bool running_;
CriticalSectionWrapper* crit_sect_;
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc b/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc
index 88ca597..af79442 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc
@@ -15,8 +15,8 @@
#include "gtest/gtest.h"
#include "modules/video_coding/main/source/jitter_buffer.h"
#include "modules/video_coding/main/source/media_opt_util.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
#include "modules/video_coding/main/source/packet.h"
+#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc {
@@ -145,10 +145,10 @@
enum { kDefaultFramePeriodMs = 1000 / kDefaultFrameRate };
virtual void SetUp() {
- clock_ = new FakeTickTime(0);
- jitter_buffer_ = new VCMJitterBuffer(clock_);
+ clock_.reset(new SimulatedClock(0));
+ jitter_buffer_ = new VCMJitterBuffer(clock_.get());
stream_generator = new StreamGenerator(0, 0,
- clock_->MillisecondTimestamp());
+ clock_->TimeInMilliseconds());
jitter_buffer_->Start();
memset(data_buffer_, 0, kDataBufferSize);
}
@@ -157,7 +157,6 @@
jitter_buffer_->Stop();
delete stream_generator;
delete jitter_buffer_;
- delete clock_;
}
VCMFrameBufferEnum InsertPacketAndPop(int index) {
@@ -190,9 +189,9 @@
stream_generator->GenerateFrame(frame_type,
(frame_type != kFrameEmpty) ? 1 : 0,
(frame_type == kFrameEmpty) ? 1 : 0,
- clock_->MillisecondTimestamp());
+ clock_->TimeInMilliseconds());
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
- clock_->IncrementDebugClock(kDefaultFramePeriodMs);
+ clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
}
void InsertFrames(int num_frames, FrameType frame_type) {
@@ -203,8 +202,8 @@
void DropFrame(int num_packets) {
stream_generator->GenerateFrame(kVideoFrameDelta, num_packets, 0,
- clock_->MillisecondTimestamp());
- clock_->IncrementDebugClock(kDefaultFramePeriodMs);
+ clock_->TimeInMilliseconds());
+ clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
}
bool DecodeCompleteFrame() {
@@ -223,7 +222,7 @@
VCMJitterBuffer* jitter_buffer_;
StreamGenerator* stream_generator;
- FakeTickTime* clock_;
+ scoped_ptr<SimulatedClock> clock_;
uint8_t data_buffer_[kDataBufferSize];
};
@@ -258,7 +257,7 @@
TEST_F(TestRunningJitterBuffer, TestEmptyPackets) {
// Make sure a frame can get complete even though empty packets are missing.
stream_generator->GenerateFrame(kVideoFrameKey, 3, 3,
- clock_->MillisecondTimestamp());
+ clock_->TimeInMilliseconds());
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(4));
EXPECT_EQ(kIncomplete, InsertPacketAndPop(4));
EXPECT_EQ(kIncomplete, InsertPacketAndPop(0));
@@ -319,8 +318,8 @@
// | 1 | 2 | .. | 8 | 9 | x | 11 | 12 | .. | 19 | x | 21 | .. | 100 |
// ----------------------------------------------------------------
stream_generator->GenerateFrame(kVideoFrameKey, 100, 0,
- clock_->MillisecondTimestamp());
- clock_->IncrementDebugClock(kDefaultFramePeriodMs);
+ clock_->TimeInMilliseconds());
+ clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
// Verify that the frame is incomplete.
EXPECT_FALSE(DecodeCompleteFrame());
@@ -348,11 +347,11 @@
// ------- ------------------------------------------------------------
// | 65532 | | 65533 | 65534 | 65535 | x | 1 | .. | 9 | x | 11 |.....| 96 |
// ------- ------------------------------------------------------------
- stream_generator->Init(65532, 0, clock_->MillisecondTimestamp());
+ stream_generator->Init(65532, 0, clock_->TimeInMilliseconds());
InsertFrame(kVideoFrameKey);
EXPECT_TRUE(DecodeCompleteFrame());
stream_generator->GenerateFrame(kVideoFrameDelta, 100, 0,
- clock_->MillisecondTimestamp());
+ clock_->TimeInMilliseconds());
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
while (stream_generator->PacketsRemaining() > 1) {
if (stream_generator->NextSequenceNumber() % 10 != 0)
diff --git a/webrtc/modules/video_coding/main/source/media_optimization.cc b/webrtc/modules/video_coding/main/source/media_optimization.cc
index 8dd47fc..dd428b4 100644
--- a/webrtc/modules/video_coding/main/source/media_optimization.cc
+++ b/webrtc/modules/video_coding/main/source/media_optimization.cc
@@ -13,12 +13,12 @@
#include "content_metrics_processing.h"
#include "frame_dropper.h"
#include "qm_select.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc {
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id,
- TickTimeBase* clock):
+ Clock* clock):
_id(id),
_clock(clock),
_maxBitRate(0),
@@ -46,7 +46,7 @@
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
_frameDropper = new VCMFrameDropper(_id);
- _lossProtLogic = new VCMLossProtectionLogic(_clock->MillisecondTimestamp());
+ _lossProtLogic = new VCMLossProtectionLogic(_clock->TimeInMilliseconds());
_content = new VCMContentMetricsProcessing();
_qmResolution = new VCMQmResolution();
}
@@ -66,12 +66,12 @@
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
_incomingFrameRate = 0.0;
_frameDropper->Reset();
- _lossProtLogic->Reset(_clock->MillisecondTimestamp());
+ _lossProtLogic->Reset(_clock->TimeInMilliseconds());
_frameDropper->SetRates(0, 0);
_content->Reset();
_qmResolution->Reset();
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
- _lossProtLogic->Reset(_clock->MillisecondTimestamp());
+ _lossProtLogic->Reset(_clock->TimeInMilliseconds());
_sendStatisticsZeroEncode = 0;
_targetBitRate = 0;
_codecWidth = 0;
@@ -122,7 +122,7 @@
// Use max window filter for now.
FilterPacketLossMode filter_mode = kMaxFilter;
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss(
- _clock->MillisecondTimestamp(), filter_mode, fractionLost);
+ _clock->TimeInMilliseconds(), filter_mode, fractionLost);
// For now use the filtered loss for computing the robustness settings
_lossProtLogic->UpdateFilteredLossPr(packetLossEnc);
@@ -274,7 +274,7 @@
// has changed. If native dimension values have changed, then either user
// initiated change, or QM initiated change. Will be able to determine only
// after the processing of the first frame.
- _lastChangeTime = _clock->MillisecondTimestamp();
+ _lastChangeTime = _clock->TimeInMilliseconds();
_content->Reset();
_content->UpdateFrameRate(frameRate);
@@ -359,7 +359,7 @@
float
VCMMediaOptimization::SentBitRate()
{
- UpdateBitRateEstimate(-1, _clock->MillisecondTimestamp());
+ UpdateBitRateEstimate(-1, _clock->TimeInMilliseconds());
return _avgSentBitRateBps / 1000.0f;
}
@@ -374,7 +374,7 @@
FrameType encodedFrameType)
{
// look into the ViE version - debug mode - needs also number of layers.
- UpdateBitRateEstimate(encodedLength, _clock->MillisecondTimestamp());
+ UpdateBitRateEstimate(encodedLength, _clock->TimeInMilliseconds());
if(encodedLength > 0)
{
const bool deltaFrame = (encodedFrameType != kVideoFrameKey &&
@@ -388,12 +388,12 @@
if (deltaFrame)
{
_lossProtLogic->UpdatePacketsPerFrame(
- minPacketsPerFrame, _clock->MillisecondTimestamp());
+ minPacketsPerFrame, _clock->TimeInMilliseconds());
}
else
{
_lossProtLogic->UpdatePacketsPerFrameKey(
- minPacketsPerFrame, _clock->MillisecondTimestamp());
+ minPacketsPerFrame, _clock->TimeInMilliseconds());
}
if (_enableQm)
@@ -544,7 +544,7 @@
_qmResolution->ResetRates();
// Reset counters
- _lastQMUpdateTime = _clock->MillisecondTimestamp();
+ _lastQMUpdateTime = _clock->TimeInMilliseconds();
// Reset content metrics
_content->Reset();
@@ -567,7 +567,7 @@
// (to sample the metrics) from the event lastChangeTime
// lastChangeTime is the time where user changed the size/rate/frame rate
// (via SetEncodingData)
- WebRtc_Word64 now = _clock->MillisecondTimestamp();
+ WebRtc_Word64 now = _clock->TimeInMilliseconds();
if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
(now - _lastChangeTime) < kQmMinIntervalMs)
{
@@ -619,7 +619,7 @@
void
VCMMediaOptimization::UpdateIncomingFrameRate()
{
- WebRtc_Word64 now = _clock->MillisecondTimestamp();
+ WebRtc_Word64 now = _clock->TimeInMilliseconds();
if (_incomingFrameTimes[0] == 0)
{
// first no shift
@@ -667,7 +667,7 @@
WebRtc_UWord32
VCMMediaOptimization::InputFrameRate()
{
- ProcessIncomingFrameRate(_clock->MillisecondTimestamp());
+ ProcessIncomingFrameRate(_clock->TimeInMilliseconds());
return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
}
diff --git a/webrtc/modules/video_coding/main/source/media_optimization.h b/webrtc/modules/video_coding/main/source/media_optimization.h
index 3b6c978..a642c5d 100644
--- a/webrtc/modules/video_coding/main/source/media_optimization.h
+++ b/webrtc/modules/video_coding/main/source/media_optimization.h
@@ -23,7 +23,7 @@
enum { kBitrateMaxFrameSamples = 60 };
enum { kBitrateAverageWinMs = 1000 };
-class TickTimeBase;
+class Clock;
class VCMContentMetricsProcessing;
class VCMFrameDropper;
@@ -38,7 +38,7 @@
class VCMMediaOptimization
{
public:
- VCMMediaOptimization(WebRtc_Word32 id, TickTimeBase* clock);
+ VCMMediaOptimization(WebRtc_Word32 id, Clock* clock);
~VCMMediaOptimization(void);
/*
* Reset the Media Optimization module
@@ -163,7 +163,7 @@
enum { kFrameHistoryWinMs = 2000};
WebRtc_Word32 _id;
- TickTimeBase* _clock;
+ Clock* _clock;
WebRtc_Word32 _maxBitRate;
VideoCodecType _sendCodecType;
WebRtc_UWord16 _codecWidth;
diff --git a/webrtc/modules/video_coding/main/source/mock/fake_tick_time.h b/webrtc/modules/video_coding/main/source/mock/fake_tick_time.h
deleted file mode 100644
index c6da348..0000000
--- a/webrtc/modules/video_coding/main/source/mock/fake_tick_time.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
-#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
-
-#include <assert.h>
-
-#include <limits>
-
-#include "modules/video_coding/main/source/tick_time_base.h"
-
-namespace webrtc {
-
-// Provides a fake implementation of TickTimeBase, intended for offline
-// testing. This implementation does not query the system clock, but returns a
-// time value set by the user when creating the object, and incremented with
-// the method IncrementDebugClock.
-class FakeTickTime : public TickTimeBase {
- public:
- explicit FakeTickTime(int64_t start_time_ms) : fake_now_ms_(start_time_ms) {}
- virtual ~FakeTickTime() {}
- virtual int64_t MillisecondTimestamp() const {
- return fake_now_ms_;
- }
- virtual int64_t MicrosecondTimestamp() const {
- return 1000 * fake_now_ms_;
- }
- virtual void IncrementDebugClock(int64_t increase_ms) {
- assert(increase_ms <= std::numeric_limits<int64_t>::max() - fake_now_ms_);
- fake_now_ms_ += increase_ms;
- }
-
- private:
- int64_t fake_now_ms_;
-};
-
-} // namespace
-
-#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
diff --git a/webrtc/modules/video_coding/main/source/receiver.cc b/webrtc/modules/video_coding/main/source/receiver.cc
index ce209e1..efb3ecd 100644
--- a/webrtc/modules/video_coding/main/source/receiver.cc
+++ b/webrtc/modules/video_coding/main/source/receiver.cc
@@ -16,13 +16,13 @@
#include "webrtc/modules/video_coding/main/source/encoded_frame.h"
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
-#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
VCMReceiver::VCMReceiver(VCMTiming* timing,
- TickTimeBase* clock,
+ Clock* clock,
int32_t vcm_id,
int32_t receiver_id,
bool master)
@@ -95,10 +95,10 @@
VCMId(vcm_id_, receiver_id_),
"Packet seq_no %u of frame %u at %u",
packet.seqNum, packet.timestamp,
- MaskWord64ToUWord32(clock_->MillisecondTimestamp()));
+ MaskWord64ToUWord32(clock_->TimeInMilliseconds()));
}
- const int64_t now_ms = clock_->MillisecondTimestamp();
+ const int64_t now_ms = clock_->TimeInMilliseconds();
int64_t render_time_ms = timing_->RenderTimeMs(packet.timestamp, now_ms);
@@ -106,7 +106,7 @@
// Render time error. Assume that this is due to some change in the
// incoming video stream and reset the JB and the timing.
jitter_buffer_.Flush();
- timing_->Reset(clock_->MillisecondTimestamp());
+ timing_->Reset(clock_->TimeInMilliseconds());
return VCM_FLUSH_INDICATOR;
} else if (render_time_ms < now_ms - kMaxVideoDelayMs) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
@@ -115,7 +115,7 @@
"Flushing jitter buffer and resetting timing.",
kMaxVideoDelayMs);
jitter_buffer_.Flush();
- timing_->Reset(clock_->MillisecondTimestamp());
+ timing_->Reset(clock_->TimeInMilliseconds());
return VCM_FLUSH_INDICATOR;
} else if (timing_->TargetVideoDelay() > kMaxVideoDelayMs) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
@@ -123,13 +123,13 @@
"More than %u ms target delay. Flushing jitter buffer and"
"resetting timing.", kMaxVideoDelayMs);
jitter_buffer_.Flush();
- timing_->Reset(clock_->MillisecondTimestamp());
+ timing_->Reset(clock_->TimeInMilliseconds());
return VCM_FLUSH_INDICATOR;
}
// First packet received belonging to this frame.
if (buffer->Length() == 0) {
- const int64_t now_ms = clock_->MillisecondTimestamp();
+ const int64_t now_ms = clock_->TimeInMilliseconds();
if (master_) {
// Only trace the primary receiver to make it possible to parse and plot
// the trace file.
@@ -171,7 +171,7 @@
// is thread-safe.
FrameType incoming_frame_type = kVideoFrameDelta;
next_render_time_ms = -1;
- const int64_t start_time_ms = clock_->MillisecondTimestamp();
+ const int64_t start_time_ms = clock_->TimeInMilliseconds();
int64_t ret = jitter_buffer_.NextTimestamp(max_wait_time_ms,
&incoming_frame_type,
&next_render_time_ms);
@@ -186,7 +186,7 @@
timing_->UpdateCurrentDelay(time_stamp);
const int32_t temp_wait_time = max_wait_time_ms -
- static_cast<int32_t>(clock_->MillisecondTimestamp() - start_time_ms);
+ static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms);
uint16_t new_max_wait_time = static_cast<uint16_t>(VCM_MAX(temp_wait_time,
0));
@@ -223,7 +223,7 @@
VCMReceiver* dual_receiver) {
// How long can we wait until we must decode the next frame.
uint32_t wait_time_ms = timing_->MaxWaitingTime(
- next_render_time_ms, clock_->MillisecondTimestamp());
+ next_render_time_ms, clock_->TimeInMilliseconds());
// Try to get a complete frame from the jitter buffer.
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
@@ -257,7 +257,7 @@
if (frame == NULL) {
// Get an incomplete frame.
if (timing_->MaxWaitingTime(next_render_time_ms,
- clock_->MillisecondTimestamp()) > 0) {
+ clock_->TimeInMilliseconds()) > 0) {
// Still time to wait for a complete frame.
return NULL;
}
@@ -286,7 +286,7 @@
// frame to the decoder, which will render the frame as soon as it has been
// decoded.
uint32_t wait_time_ms = timing_->MaxWaitingTime(
- next_render_time_ms, clock_->MillisecondTimestamp());
+ next_render_time_ms, clock_->TimeInMilliseconds());
if (max_wait_time_ms < wait_time_ms) {
// If we're not allowed to wait until the frame is supposed to be rendered
// we will have to return NULL for now.
diff --git a/webrtc/modules/video_coding/main/source/receiver.h b/webrtc/modules/video_coding/main/source/receiver.h
index 9546f18..9d18e24 100644
--- a/webrtc/modules/video_coding/main/source/receiver.h
+++ b/webrtc/modules/video_coding/main/source/receiver.h
@@ -14,11 +14,11 @@
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
#include "webrtc/modules/video_coding/main/source/packet.h"
-#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
#include "webrtc/modules/video_coding/main/source/timing.h"
namespace webrtc {
+class Clock;
class VCMEncodedFrame;
enum VCMNackStatus {
@@ -36,7 +36,7 @@
class VCMReceiver {
public:
VCMReceiver(VCMTiming* timing,
- TickTimeBase* clock,
+ Clock* clock,
int32_t vcm_id = -1,
int32_t receiver_id = -1,
bool master = true);
@@ -81,7 +81,7 @@
CriticalSectionWrapper* crit_sect_;
int32_t vcm_id_;
- TickTimeBase* clock_;
+ Clock* clock_;
int32_t receiver_id_;
bool master_;
VCMJitterBuffer jitter_buffer_;
diff --git a/webrtc/modules/video_coding/main/source/tick_time_base.h b/webrtc/modules/video_coding/main/source/tick_time_base.h
deleted file mode 100644
index a212591..0000000
--- a/webrtc/modules/video_coding/main/source/tick_time_base.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
-#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
-
-#include "system_wrappers/interface/tick_util.h"
-
-namespace webrtc {
-
-// This class provides a mockable wrapper to TickTime.
-class TickTimeBase {
- public:
- virtual ~TickTimeBase() {}
-
- // "Now" in milliseconds.
- virtual int64_t MillisecondTimestamp() const {
- return TickTime::MillisecondTimestamp();
- }
-
- // "Now" in microseconds.
- virtual int64_t MicrosecondTimestamp() const {
- return TickTime::MicrosecondTimestamp();
- }
-};
-
-} // namespace
-
-#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
diff --git a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc
index e272eb9..37ebbdd 100644
--- a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc
+++ b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc
@@ -9,13 +9,13 @@
*/
#include "internal_defines.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
#include "timestamp_extrapolator.h"
#include "trace.h"
+#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc {
-VCMTimestampExtrapolator::VCMTimestampExtrapolator(TickTimeBase* clock,
+VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock,
WebRtc_Word32 vcmId,
WebRtc_Word32 id)
:
@@ -38,7 +38,7 @@
_accMaxError(7000),
_P11(1e10)
{
- Reset(_clock->MillisecondTimestamp());
+ Reset(_clock->TimeInMilliseconds());
}
VCMTimestampExtrapolator::~VCMTimestampExtrapolator()
@@ -56,7 +56,7 @@
}
else
{
- _startMs = _clock->MillisecondTimestamp();
+ _startMs = _clock->TimeInMilliseconds();
}
_prevMs = _startMs;
_firstTimestamp = 0;
diff --git a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h
index 901d8d4..1661f54 100644
--- a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h
+++ b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h
@@ -17,12 +17,12 @@
namespace webrtc
{
-class TickTimeBase;
+class Clock;
class VCMTimestampExtrapolator
{
public:
- VCMTimestampExtrapolator(TickTimeBase* clock,
+ VCMTimestampExtrapolator(Clock* clock,
WebRtc_Word32 vcmId = 0,
WebRtc_Word32 receiverId = 0);
~VCMTimestampExtrapolator();
@@ -37,16 +37,16 @@
RWLockWrapper* _rwLock;
WebRtc_Word32 _vcmId;
WebRtc_Word32 _id;
- TickTimeBase* _clock;
- double _w[2];
- double _P[2][2];
+ Clock* _clock;
+ double _w[2];
+ double _P[2][2];
WebRtc_Word64 _startMs;
WebRtc_Word64 _prevMs;
WebRtc_UWord32 _firstTimestamp;
WebRtc_Word32 _wrapArounds;
WebRtc_UWord32 _prevTs90khz;
- const double _lambda;
- bool _firstAfterReset;
+ const double _lambda;
+ bool _firstAfterReset;
WebRtc_UWord32 _packetCount;
const WebRtc_UWord32 _startUpFilterDelayInPackets;
diff --git a/webrtc/modules/video_coding/main/source/timing.cc b/webrtc/modules/video_coding/main/source/timing.cc
index aca05fa..36131b1 100644
--- a/webrtc/modules/video_coding/main/source/timing.cc
+++ b/webrtc/modules/video_coding/main/source/timing.cc
@@ -8,15 +8,17 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "trace.h"
-#include "internal_defines.h"
-#include "jitter_buffer_common.h"
-#include "timing.h"
-#include "timestamp_extrapolator.h"
+#include "webrtc/modules/video_coding/main/source/timing.h"
+
+#include "webrtc/modules/video_coding/main/source/internal_defines.h"
+#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.h"
+#include "webrtc/modules/video_coding/main/source/timestamp_extrapolator.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
-VCMTiming::VCMTiming(TickTimeBase* clock,
+VCMTiming::VCMTiming(Clock* clock,
WebRtc_Word32 vcmId,
WebRtc_Word32 timingId,
VCMTiming* masterTiming)
diff --git a/webrtc/modules/video_coding/main/source/timing.h b/webrtc/modules/video_coding/main/source/timing.h
index 41a4945..ac650ec 100644
--- a/webrtc/modules/video_coding/main/source/timing.h
+++ b/webrtc/modules/video_coding/main/source/timing.h
@@ -18,7 +18,7 @@
namespace webrtc
{
-class TickTimeBase;
+class Clock;
class VCMTimestampExtrapolator;
class VCMTiming
@@ -26,7 +26,7 @@
public:
// The primary timing component should be passed
// if this is the dual timing component.
- VCMTiming(TickTimeBase* clock,
+ VCMTiming(Clock* clock,
WebRtc_Word32 vcmId = 0,
WebRtc_Word32 timingId = 0,
VCMTiming* masterTiming = NULL);
@@ -94,7 +94,7 @@
private:
CriticalSectionWrapper* _critSect;
WebRtc_Word32 _vcmId;
- TickTimeBase* _clock;
+ Clock* _clock;
WebRtc_Word32 _timingId;
bool _master;
VCMTimestampExtrapolator* _tsExtrapolator;
diff --git a/webrtc/modules/video_coding/main/source/video_coding.gypi b/webrtc/modules/video_coding/main/source/video_coding.gypi
index 2b9d4bd..b795f90 100644
--- a/webrtc/modules/video_coding/main/source/video_coding.gypi
+++ b/webrtc/modules/video_coding/main/source/video_coding.gypi
@@ -62,7 +62,6 @@
'receiver.h',
'rtt_filter.h',
'session_info.h',
- 'tick_time_base.h',
'timestamp_extrapolator.h',
'timestamp_map.h',
'timing.h',
diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.cc b/webrtc/modules/video_coding/main/source/video_coding_impl.cc
index 8fba7de..11725ad 100644
--- a/webrtc/modules/video_coding/main/source/video_coding_impl.cc
+++ b/webrtc/modules/video_coding/main/source/video_coding_impl.cc
@@ -16,7 +16,7 @@
#include "packet.h"
#include "trace.h"
#include "video_codec_interface.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc
{
@@ -34,22 +34,20 @@
{
return static_cast<WebRtc_UWord32>(
VCM_MAX(static_cast<WebRtc_Word64>(_periodMs) -
- (_clock->MillisecondTimestamp() - _latestMs), 0));
+ (_clock->TimeInMilliseconds() - _latestMs), 0));
}
void
VCMProcessTimer::Processed()
{
- _latestMs = _clock->MillisecondTimestamp();
+ _latestMs = _clock->TimeInMilliseconds();
}
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
- TickTimeBase* clock,
- bool delete_clock_on_destroy)
+ Clock* clock)
:
_id(id),
clock_(clock),
-delete_clock_on_destroy_(delete_clock_on_destroy),
_receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_receiverInited(false),
_timing(clock_, id, 1),
@@ -99,7 +97,6 @@
}
delete _receiveCritSect;
delete _sendCritSect;
- if (delete_clock_on_destroy_) delete clock_;
#ifdef DEBUG_DECODER_BIT_STREAM
fclose(_bitStreamBeforeDecoder);
#endif
@@ -112,14 +109,14 @@
VideoCodingModule*
VideoCodingModule::Create(const WebRtc_Word32 id)
{
- return new VideoCodingModuleImpl(id, new TickTimeBase(), true);
+ return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock());
}
VideoCodingModule*
-VideoCodingModule::Create(const WebRtc_Word32 id, TickTimeBase* clock)
+VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock)
{
assert(clock);
- return new VideoCodingModuleImpl(id, clock, false);
+ return new VideoCodingModuleImpl(id, clock);
}
void
@@ -890,7 +887,7 @@
// If this frame was too late, we should adjust the delay accordingly
_timing.UpdateCurrentDelay(frame->RenderTimeMs(),
- clock_->MillisecondTimestamp());
+ clock_->TimeInMilliseconds());
#ifdef DEBUG_DECODER_BIT_STREAM
if (_bitStreamBeforeDecoder != NULL)
@@ -1001,7 +998,7 @@
dualFrame->TimeStamp());
// Decode dualFrame and try to catch up
WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame,
- clock_->MillisecondTimestamp());
+ clock_->TimeInMilliseconds());
if (ret != WEBRTC_VIDEO_CODEC_OK)
{
WEBRTC_TRACE(webrtc::kTraceWarning,
@@ -1049,7 +1046,7 @@
return VCM_NO_CODEC_REGISTERED;
}
// Decode a frame
- WebRtc_Word32 ret = _decoder->Decode(frame, clock_->MillisecondTimestamp());
+ WebRtc_Word32 ret = _decoder->Decode(frame, clock_->TimeInMilliseconds());
// Check for failed decoding, run frame type request callback if needed.
if (ret < 0)
diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.h b/webrtc/modules/video_coding/main/source/video_coding_impl.h
index 80e3c81..e09872e 100644
--- a/webrtc/modules/video_coding/main/source/video_coding_impl.h
+++ b/webrtc/modules/video_coding/main/source/video_coding_impl.h
@@ -15,16 +15,16 @@
#include <vector>
-#include "modules/video_coding/main/source/codec_database.h"
-#include "modules/video_coding/main/source/frame_buffer.h"
-#include "modules/video_coding/main/source/generic_decoder.h"
-#include "modules/video_coding/main/source/generic_encoder.h"
-#include "modules/video_coding/main/source/jitter_buffer.h"
-#include "modules/video_coding/main/source/media_optimization.h"
-#include "modules/video_coding/main/source/receiver.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
-#include "modules/video_coding/main/source/timing.h"
-#include "system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/modules/video_coding/main/source/codec_database.h"
+#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
+#include "webrtc/modules/video_coding/main/source/generic_decoder.h"
+#include "webrtc/modules/video_coding/main/source/generic_encoder.h"
+#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
+#include "webrtc/modules/video_coding/main/source/media_optimization.h"
+#include "webrtc/modules/video_coding/main/source/receiver.h"
+#include "webrtc/modules/video_coding/main/source/timing.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
namespace webrtc
{
@@ -32,16 +32,16 @@
class VCMProcessTimer
{
public:
- VCMProcessTimer(WebRtc_UWord32 periodMs, TickTimeBase* clock)
+ VCMProcessTimer(WebRtc_UWord32 periodMs, Clock* clock)
: _clock(clock),
_periodMs(periodMs),
- _latestMs(_clock->MillisecondTimestamp()) {}
+ _latestMs(_clock->TimeInMilliseconds()) {}
WebRtc_UWord32 Period() const;
WebRtc_UWord32 TimeUntilProcess() const;
void Processed();
private:
- TickTimeBase* _clock;
+ Clock* _clock;
WebRtc_UWord32 _periodMs;
WebRtc_Word64 _latestMs;
};
@@ -59,8 +59,7 @@
{
public:
VideoCodingModuleImpl(const WebRtc_Word32 id,
- TickTimeBase* clock,
- bool delete_clock_on_destroy);
+ Clock* clock);
virtual ~VideoCodingModuleImpl();
@@ -275,8 +274,7 @@
private:
WebRtc_Word32 _id;
- TickTimeBase* clock_;
- bool delete_clock_on_destroy_;
+ Clock* clock_;
CriticalSectionWrapper* _receiveCritSect;
bool _receiverInited;
VCMTiming _timing;
diff --git a/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc b/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc
index 0ee9657..ccf37eb 100644
--- a/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc
+++ b/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc
@@ -13,7 +13,7 @@
#include "modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
#include "modules/video_coding/main/interface/video_coding.h"
#include "modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
+#include "webrtc/system_wrappers/interface/clock.h"
namespace webrtc {
@@ -32,9 +32,9 @@
static const size_t kPayloadLen = 10;
virtual void SetUp() {
- clock_ = new FakeTickTime(0);
- ASSERT_TRUE(clock_ != NULL);
- vcm_ = VideoCodingModule::Create(0, clock_);
+ clock_.reset(new SimulatedClock(0));
+ ASSERT_TRUE(clock_.get() != NULL);
+ vcm_ = VideoCodingModule::Create(0, clock_.get());
ASSERT_TRUE(vcm_ != NULL);
ASSERT_EQ(0, vcm_->InitializeReceiver());
ASSERT_EQ(0, vcm_->RegisterFrameTypeCallback(&frame_type_callback_));
@@ -48,7 +48,6 @@
virtual void TearDown() {
VideoCodingModule::Destroy(vcm_);
- delete clock_;
}
void InsertPacket(uint32_t timestamp,
@@ -77,7 +76,7 @@
MockPacketRequestCallback request_callback_;
NiceMock<MockVideoDecoder> decoder_;
NiceMock<MockVideoDecoder> decoderCopy_;
- FakeTickTime* clock_;
+ scoped_ptr<SimulatedClock> clock_;
};
TEST_F(VCMRobustnessTest, TestHardNack) {
@@ -112,21 +111,21 @@
ASSERT_EQ(VCM_OK, vcm_->Decode(0));
ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
ASSERT_EQ(VCM_OK, vcm_->Process());
ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
ASSERT_EQ(VCM_OK, vcm_->Process());
ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
ASSERT_EQ(VCM_OK, vcm_->Process());
ASSERT_EQ(VCM_OK, vcm_->Decode(0));
@@ -149,7 +148,7 @@
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
ASSERT_EQ(VCM_OK, vcm_->Process());
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
ASSERT_EQ(VCM_OK, vcm_->Process());
@@ -217,13 +216,13 @@
InsertPacket(0, 2, false, true, kVideoFrameKey);
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 0.
- clock_->IncrementDebugClock(33);
+ clock_->AdvanceTimeMilliseconds(33);
InsertPacket(3000, 3, true, false, kVideoFrameDelta);
// Packet 4 missing
InsertPacket(3000, 5, false, true, kVideoFrameDelta);
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
- clock_->IncrementDebugClock(33);
+ clock_->AdvanceTimeMilliseconds(33);
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
@@ -232,7 +231,7 @@
// Spawn a decoder copy.
EXPECT_EQ(0, vcm_->DecodeDualFrame(0)); // Expect no dual decoder action.
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
EXPECT_EQ(VCM_OK, vcm_->Process()); // Generate NACK list.
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 6000 complete.
@@ -299,25 +298,25 @@
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 0.
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(33);
+ clock_->AdvanceTimeMilliseconds(33);
InsertPacket(3000, 3, true, false, kVideoFrameDelta);
// Packet 4 missing
InsertPacket(3000, 5, false, true, kVideoFrameDelta);
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(33);
+ clock_->AdvanceTimeMilliseconds(33);
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 3000 incomplete.
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 6000 complete.
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(23);
+ clock_->AdvanceTimeMilliseconds(23);
InsertPacket(3000, 4, false, false, kVideoFrameDelta);
InsertPacket(9000, 9, true, false, kVideoFrameDelta);
@@ -371,14 +370,14 @@
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 0.
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(33);
+ clock_->AdvanceTimeMilliseconds(33);
InsertPacket(3000, 3, true, false, kVideoFrameDelta);
// Packet 4 missing
InsertPacket(3000, 5, false, true, kVideoFrameDelta);
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(33);
+ clock_->AdvanceTimeMilliseconds(33);
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
@@ -386,11 +385,12 @@
// Schedule key frame request.
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(10);
+ clock_->AdvanceTimeMilliseconds(10);
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 6000 complete.
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
- clock_->IncrementDebugClock(500); // Wait for the key request timer to set.
+ // Wait for the key request timer to set.
+ clock_->AdvanceTimeMilliseconds(500);
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect key frame request.
}
} // namespace webrtc