Delete all use of tick_util.h.
Depends on Chrome cl https://codereview.chromium.org/1888003002/, which was landed some time ago. BUG=webrtc:5740 R=stefan@webrtc.org, tommi@webrtc.org Review URL: https://codereview.webrtc.org/1888593004 . Cr-Commit-Position: refs/heads/master@{#12674}
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/system_wrappers/include/cpu_info.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -198,7 +199,7 @@ bool VideoProcessorImpl::ProcessFrame(int frame_number) {
|
||||
// Ensure we have a new statistics data object we can fill:
|
||||
FrameStatistic& stat = stats_->NewFrame(frame_number);
|
||||
|
||||
encode_start_ = TickTime::Now();
|
||||
encode_start_ns_ = rtc::TimeNanos();
|
||||
// Use the frame number as "timestamp" to identify frames
|
||||
source_frame_.set_timestamp(frame_number);
|
||||
|
||||
@ -248,11 +249,11 @@ void VideoProcessorImpl::FrameEncoded(
|
||||
|
||||
encoded_frame_type_ = encoded_image._frameType;
|
||||
|
||||
TickTime encode_stop = TickTime::Now();
|
||||
int64_t encode_stop_ns = rtc::TimeNanos();
|
||||
int frame_number = encoded_image._timeStamp;
|
||||
FrameStatistic& stat = stats_->stats_[frame_number];
|
||||
stat.encode_time_in_us =
|
||||
GetElapsedTimeMicroseconds(encode_start_, encode_stop);
|
||||
GetElapsedTimeMicroseconds(encode_start_ns_, encode_stop_ns);
|
||||
stat.encoding_successful = true;
|
||||
stat.encoded_frame_length_in_bytes = encoded_image._length;
|
||||
stat.frame_number = encoded_image._timeStamp;
|
||||
@ -299,7 +300,7 @@ void VideoProcessorImpl::FrameEncoded(
|
||||
|
||||
// Keep track of if frames are lost due to packet loss so we can tell
|
||||
// this to the encoder (this is handled by the RTP logic in the full stack)
|
||||
decode_start_ = TickTime::Now();
|
||||
decode_start_ns_ = rtc::TimeNanos();
|
||||
// TODO(kjellander): Pass fragmentation header to the decoder when
|
||||
// CL 172001 has been submitted and PacketManipulator supports this.
|
||||
int32_t decode_result =
|
||||
@ -315,12 +316,12 @@ void VideoProcessorImpl::FrameEncoded(
|
||||
}
|
||||
|
||||
void VideoProcessorImpl::FrameDecoded(const VideoFrame& image) {
|
||||
TickTime decode_stop = TickTime::Now();
|
||||
int64_t decode_stop_ns = rtc::TimeNanos();
|
||||
int frame_number = image.timestamp();
|
||||
// Report stats
|
||||
FrameStatistic& stat = stats_->stats_[frame_number];
|
||||
stat.decode_time_in_us =
|
||||
GetElapsedTimeMicroseconds(decode_start_, decode_stop);
|
||||
GetElapsedTimeMicroseconds(decode_start_ns_, decode_stop_ns);
|
||||
stat.decoding_successful = true;
|
||||
|
||||
// Check for resize action (either down or up):
|
||||
@ -378,10 +379,9 @@ void VideoProcessorImpl::FrameDecoded(const VideoFrame& image) {
|
||||
}
|
||||
}
|
||||
|
||||
int VideoProcessorImpl::GetElapsedTimeMicroseconds(
|
||||
const webrtc::TickTime& start,
|
||||
const webrtc::TickTime& stop) {
|
||||
uint64_t encode_time = (stop - start).Microseconds();
|
||||
int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start,
|
||||
int64_t stop) {
|
||||
uint64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec;
|
||||
assert(encode_time <
|
||||
static_cast<unsigned int>(std::numeric_limits<int>::max()));
|
||||
return static_cast<int>(encode_time);
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
|
||||
#include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h"
|
||||
#include "webrtc/modules/video_coding/codecs/test/stats.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
#include "webrtc/test/testsupport/frame_reader.h"
|
||||
#include "webrtc/test/testsupport/frame_writer.h"
|
||||
#include "webrtc/video_frame.h"
|
||||
@ -179,8 +178,7 @@ class VideoProcessorImpl : public VideoProcessor {
|
||||
void FrameDecoded(const webrtc::VideoFrame& image);
|
||||
// Used for getting a 32-bit integer representing time
|
||||
// (checks the size is within signed 32-bit bounds before casting it)
|
||||
int GetElapsedTimeMicroseconds(const webrtc::TickTime& start,
|
||||
const webrtc::TickTime& stop);
|
||||
int GetElapsedTimeMicroseconds(int64_t start, int64_t stop);
|
||||
// Updates the encoder with the target bit rate and the frame rate.
|
||||
void SetRates(int bit_rate, int frame_rate) override;
|
||||
// Return the size of the encoded frame in bytes.
|
||||
@ -225,8 +223,8 @@ class VideoProcessorImpl : public VideoProcessor {
|
||||
|
||||
// Statistics
|
||||
double bit_rate_factor_; // multiply frame length with this to get bit rate
|
||||
webrtc::TickTime encode_start_;
|
||||
webrtc::TickTime decode_start_;
|
||||
int64_t encode_start_ns_;
|
||||
int64_t decode_start_ns_;
|
||||
|
||||
// Callback class required to implement according to the VideoEncoder API.
|
||||
class VideoProcessorEncodeCompleteCallback
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -159,8 +159,8 @@ class TestVp8Impl : public ::testing::Test {
|
||||
}
|
||||
|
||||
size_t WaitForEncodedFrame() const {
|
||||
int64_t startTime = TickTime::MillisecondTimestamp();
|
||||
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs) {
|
||||
int64_t startTime = rtc::TimeMillis();
|
||||
while (rtc::TimeMillis() - startTime < kMaxWaitEncTimeMs) {
|
||||
if (encode_complete_callback_->EncodeComplete()) {
|
||||
return encoded_frame_._length;
|
||||
}
|
||||
@ -169,8 +169,8 @@ class TestVp8Impl : public ::testing::Test {
|
||||
}
|
||||
|
||||
size_t WaitForDecodedFrame() const {
|
||||
int64_t startTime = TickTime::MillisecondTimestamp();
|
||||
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitDecTimeMs) {
|
||||
int64_t startTime = rtc::TimeMillis();
|
||||
while (rtc::TimeMillis() - startTime < kMaxWaitDecTimeMs) {
|
||||
if (decode_complete_callback_->DecodeComplete()) {
|
||||
return CalcBufferSize(kI420, decoded_frame_.width(),
|
||||
decoded_frame_.height());
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "libyuv/convert.h" // NOLINT
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
@ -29,7 +30,6 @@
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
@ -166,7 +166,7 @@ VP8EncoderImpl::VP8EncoderImpl()
|
||||
tl1_frame_dropper_(kTl1MaxTimeToDropFrames),
|
||||
key_frame_request_(kMaxSimulcastStreams, false),
|
||||
quality_scaler_enabled_(false) {
|
||||
uint32_t seed = static_cast<uint32_t>(TickTime::MillisecondTimestamp());
|
||||
uint32_t seed = rtc::Time32();
|
||||
srand(seed);
|
||||
|
||||
picture_id_.reserve(kMaxSimulcastStreams);
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/common_video/include/video_image.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/test/testsupport/metrics/video_metrics.h"
|
||||
#include "webrtc/tools/simple_command_line_parser.h"
|
||||
@ -158,7 +158,7 @@ int SequenceCoder(webrtc::test::CommandLineParser* parser) {
|
||||
decoder->RegisterDecodeCompleteCallback(&decoder_callback);
|
||||
// Read->Encode->Decode sequence.
|
||||
// num_frames = -1 implies unlimited encoding (entire sequence).
|
||||
int64_t starttime = webrtc::TickTime::MillisecondTimestamp();
|
||||
int64_t starttime = rtc::TimeMillis();
|
||||
int frame_cnt = 1;
|
||||
int frames_processed = 0;
|
||||
input_frame.CreateEmptyFrame(width, height, width, half_width, half_width);
|
||||
@ -176,7 +176,7 @@ int SequenceCoder(webrtc::test::CommandLineParser* parser) {
|
||||
++frame_cnt;
|
||||
}
|
||||
printf("\nProcessed %d frames\n", frames_processed);
|
||||
int64_t endtime = webrtc::TickTime::MillisecondTimestamp();
|
||||
int64_t endtime = rtc::TimeMillis();
|
||||
int64_t totalExecutionTime = endtime - starttime;
|
||||
printf("Total execution time: %.2lf ms\n",
|
||||
static_cast<double>(totalExecutionTime));
|
||||
|
||||
@ -22,13 +22,13 @@
|
||||
#include "vpx/vp8dx.h"
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/base/keep_ref_until_done.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/include/module_common_types.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp9/screenshare_layers.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -77,7 +77,7 @@ VP9EncoderImpl::VP9EncoderImpl()
|
||||
// Use two spatial when screensharing with flexible mode.
|
||||
spatial_layer_(new ScreenshareLayersVP9(2)) {
|
||||
memset(&codec_, 0, sizeof(codec_));
|
||||
uint32_t seed = static_cast<uint32_t>(TickTime::MillisecondTimestamp());
|
||||
uint32_t seed = rtc::Time32();
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -30,7 +30,7 @@ class IvfFileWriterTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
const int64_t start_id =
|
||||
reinterpret_cast<int64_t>(this) ^ TickTime::MicrosecondTimestamp();
|
||||
reinterpret_cast<int64_t>(this) ^ rtc::TimeMicros();
|
||||
int64_t id = start_id;
|
||||
do {
|
||||
std::ostringstream oss;
|
||||
|
||||
Reference in New Issue
Block a user