diff --git a/src/modules/video_coding/main/source/mock/fake_tick_time_interface.h b/src/modules/video_coding/main/source/mock/fake_tick_time_interface.h new file mode 100644 index 0000000000..0b8cbaa67f --- /dev/null +++ b/src/modules/video_coding/main/source/mock/fake_tick_time_interface.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#include "modules/video_coding/main/source/tick_time_wrapper.h" + +#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_WRAPPER_H_ +#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_WRAPPER_H_ + +namespace webrtc { + +class FakeTickTime : public TickTimeInterface +{ + public: + FakeTickTime(int64_t start_time_ms) + : fake_now_(TickTime::Now()) { + fake_now_ += (MillisecondsToTicks(start_time_ms) - fake_now_.Ticks()); + } + virtual TickTime Now() const { return fake_now_; } + virtual int64_t MillisecondTimestamp() const { + return TicksToMilliseconds(Now().Ticks()); + } + virtual int64_t MicrosecondTimestamp() const { + return 1000 * TicksToMilliseconds(Now().Ticks()); + } + virtual void IncrementDebugClock(int64_t increase_ms) { + fake_now_ += MillisecondsToTicks(increase_ms); + } + + private: + TickTime fake_now_; +}; + +} // namespace + +#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_WRAPPER_H_ diff --git a/src/modules/video_coding/main/source/tick_time_interface.h b/src/modules/video_coding/main/source/tick_time_interface.h new file mode 100644 index 0000000000..1ab63e2781 --- /dev/null +++ b/src/modules/video_coding/main/source/tick_time_interface.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#include "system_wrappers/interface/tick_util.h" + +#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_WRAPPER_H_ +#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_WRAPPER_H_ + +namespace webrtc { + +class TickTimeInterface : public TickTime { + public: + // Current time in the tick domain. + virtual TickTime Now() const { return TickTime::Now(); } + + // Now in the time domain in ms. + virtual int64_t MillisecondTimestamp() const { + return TickTime::MillisecondTimestamp(); + } + + // Now in the time domain in us. + virtual int64_t MicrosecondTimestamp() const { + return TickTime::MicrosecondTimestamp(); + } +}; + +} // namespace + +#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_WRAPPER_H_ diff --git a/src/modules/video_coding/main/source/video_coding.gypi b/src/modules/video_coding/main/source/video_coding.gypi index 3b790389a9..21598965d7 100644 --- a/src/modules/video_coding/main/source/video_coding.gypi +++ b/src/modules/video_coding/main/source/video_coding.gypi @@ -64,6 +64,7 @@ 'rtt_filter.h', 'session_info.h', 'tick_time.h', + 'tick_time_interface.h', 'timestamp_extrapolator.h', 'timestamp_map.h', 'timing.h',