Removing avoidable usages of Clock::GetRealTimeClock().

Bug: webrtc:10365
Change-Id: I56523f9b4de697b9136d7f8df74f43051c7b5b42
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130484
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27363}
diff --git a/call/call.cc b/call/call.cc
index 8dcd785..3f7ef5f 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -884,7 +884,7 @@
   std::unique_ptr<FecController> fec_controller =
       config_.fec_controller_factory
           ? config_.fec_controller_factory->CreateFecController()
-          : absl::make_unique<FecControllerDefault>(Clock::GetRealTimeClock());
+          : absl::make_unique<FecControllerDefault>(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 87edf10..74015a8 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
@@ -81,7 +81,6 @@
   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 b755449..4638652 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 @@
     Call* send_call,
     const std::map<uint8_t, MediaType>& 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 @@
                               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 @@
 
 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 d70748f..15d765e 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 @@
   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 b72048e..cb6c6f1 100644
--- a/video/video_analyzer.cc
+++ b/video/video_analyzer.cc
@@ -220,8 +220,7 @@
     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 @@
   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 @@
 }
 
 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 23c703e..e30b459 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -1133,8 +1133,7 @@
   }
   return absl::make_unique<test::LayerFilteringTransport>(
       &task_queue_,
-      absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
-                                         std::move(network_behavior)),
+      absl::make_unique<FakeNetworkPipe>(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 @@
   }
   return absl::make_unique<test::DirectTransport>(
       &task_queue_,
-      absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
-                                         std::move(network_behavior)),
+      absl::make_unique<FakeNetworkPipe>(clock_, std::move(network_behavior)),
       receiver_call_.get(), payload_type_map_);
 }