From 11c012a4ce1cb6fedd920ca524bbfd4e254ed224 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Fri, 29 Mar 2019 14:17:26 +0100 Subject: [PATCH] Removing avoidable usages of Clock::GetRealTimeClock(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:10365 Change-Id: I56523f9b4de697b9136d7f8df74f43051c7b5b42 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130484 Reviewed-by: Åsa Persson Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#27363} --- call/call.cc | 2 +- call/rtp_video_sender.cc | 1 - test/direct_transport.cc | 10 ++++------ test/direct_transport.h | 2 -- video/video_analyzer.cc | 8 +++----- video/video_quality_test.cc | 6 ++---- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/call/call.cc b/call/call.cc index 8dcd785b8c..3f7ef5ff22 100644 --- a/call/call.cc +++ b/call/call.cc @@ -884,7 +884,7 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream( std::unique_ptr fec_controller = config_.fec_controller_factory ? config_.fec_controller_factory->CreateFecController() - : absl::make_unique(Clock::GetRealTimeClock()); + : absl::make_unique(clock_); return CreateVideoSendStream(std::move(config), std::move(encoder_config), std::move(fec_controller)); } diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc index 87edf10a86..74015a8668 100644 --- a/call/rtp_video_sender.cc +++ b/call/rtp_video_sender.cc @@ -81,7 +81,6 @@ std::vector CreateRtpStreamSenders( RtpRtcp::Configuration configuration; configuration.clock = clock; configuration.audio = false; - configuration.clock = Clock::GetRealTimeClock(); configuration.receiver_only = false; configuration.outgoing_transport = send_transport; configuration.intra_frame_callback = intra_frame_callback; diff --git a/test/direct_transport.cc b/test/direct_transport.cc index b7554496c6..4638652163 100644 --- a/test/direct_transport.cc +++ b/test/direct_transport.cc @@ -13,7 +13,7 @@ #include "call/call.h" #include "call/fake_network_pipe.h" #include "modules/rtp_rtcp/include/rtp_header_parser.h" -#include "system_wrappers/include/clock.h" +#include "rtc_base/time_utils.h" #include "test/single_threaded_task_queue.h" namespace webrtc { @@ -42,7 +42,6 @@ DirectTransport::DirectTransport( Call* send_call, const std::map& payload_type_map) : send_call_(send_call), - clock_(Clock::GetRealTimeClock()), task_queue_(task_queue), demuxer_(payload_type_map), fake_network_(std::move(pipe)) { @@ -69,8 +68,7 @@ bool DirectTransport::SendRtp(const uint8_t* data, size_t length, const PacketOptions& options) { if (send_call_) { - rtc::SentPacket sent_packet(options.packet_id, - clock_->TimeInMilliseconds()); + rtc::SentPacket sent_packet(options.packet_id, rtc::TimeMillis()); sent_packet.info.included_in_feedback = options.included_in_feedback; sent_packet.info.included_in_allocation = options.included_in_allocation; sent_packet.info.packet_size_bytes = length; @@ -88,9 +86,9 @@ bool DirectTransport::SendRtcp(const uint8_t* data, size_t length) { void DirectTransport::SendPacket(const uint8_t* data, size_t length) { MediaType media_type = demuxer_.GetMediaType(data, length); - int64_t send_time = clock_->TimeInMicroseconds(); + int64_t send_time_us = rtc::TimeMicros(); fake_network_->DeliverPacket(media_type, rtc::CopyOnWriteBuffer(data, length), - send_time); + send_time_us); rtc::CritScope cs(&process_lock_); if (!next_process_task_) ProcessPackets(); diff --git a/test/direct_transport.h b/test/direct_transport.h index d70748ffc6..15d765edd6 100644 --- a/test/direct_transport.h +++ b/test/direct_transport.h @@ -22,7 +22,6 @@ namespace webrtc { -class Clock; class PacketReceiver; namespace test { @@ -65,7 +64,6 @@ class DirectTransport : public Transport { void Start(); Call* const send_call_; - Clock* const clock_; SingleThreadedTaskQueueForTesting* const task_queue_; diff --git a/video/video_analyzer.cc b/video/video_analyzer.cc index b72048e6d9..cb6c6f1aaf 100644 --- a/video/video_analyzer.cc +++ b/video/video_analyzer.cc @@ -220,8 +220,7 @@ PacketReceiver::DeliveryStatus VideoAnalyzer::DeliverPacket( rtc::CritScope lock(&crit_); int64_t timestamp = wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); - recv_times_[timestamp] = - Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); + recv_times_[timestamp] = clock_->CurrentNtpInMilliseconds(); } return receiver_->DeliverPacket(media_type, std::move(packet), @@ -254,7 +253,7 @@ bool VideoAnalyzer::SendRtp(const uint8_t* packet, RTPHeader header; parser.Parse(&header); - int64_t current_time = Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); + int64_t current_time = clock_->CurrentNtpInMilliseconds(); bool result = transport_->SendRtp(packet, length, options); { @@ -292,8 +291,7 @@ bool VideoAnalyzer::SendRtcp(const uint8_t* packet, size_t length) { } void VideoAnalyzer::OnFrame(const VideoFrame& video_frame) { - int64_t render_time_ms = - Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); + int64_t render_time_ms = clock_->CurrentNtpInMilliseconds(); rtc::CritScope lock(&crit_); diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc index 23c703e659..e30b459362 100644 --- a/video/video_quality_test.cc +++ b/video/video_quality_test.cc @@ -1133,8 +1133,7 @@ VideoQualityTest::CreateSendTransport() { } return absl::make_unique( &task_queue_, - absl::make_unique(Clock::GetRealTimeClock(), - std::move(network_behavior)), + absl::make_unique(clock_, std::move(network_behavior)), sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, params_.video[0].selected_tl, params_.ss[0].selected_sl, payload_type_map_, kVideoSendSsrcs[0], @@ -1152,8 +1151,7 @@ VideoQualityTest::CreateReceiveTransport() { } return absl::make_unique( &task_queue_, - absl::make_unique(Clock::GetRealTimeClock(), - std::move(network_behavior)), + absl::make_unique(clock_, std::move(network_behavior)), receiver_call_.get(), payload_type_map_); }