Use injected clock in channel_receive
Stops using the global clock methods from time_utils.
This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).
R=danilchap@webrtc.org, hta@webrtc.org
Bug: webrtc:42223992
Change-Id: Iee8ab7528aa6c453a9aaa79fb1794fa14b1c468a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404960
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45382}
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index eda5824..90d3c70 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -78,7 +78,6 @@
 #include "rtc_base/synchronization/mutex.h"
 #include "rtc_base/system/no_unique_address.h"
 #include "rtc_base/thread_annotations.h"
-#include "rtc_base/time_utils.h"
 #include "rtc_base/trace_event.h"
 #include "system_wrappers/include/metrics.h"
 #include "system_wrappers/include/ntp_time.h"
@@ -658,7 +657,7 @@
 
 void ChannelReceive::OnRtpPacket(const RtpPacketReceived& packet) {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
-  Timestamp now = Timestamp::Millis(TimeMillis());
+  Timestamp now = env_.clock().CurrentTime();
 
   last_received_rtp_timestamp_ = packet.Timestamp();
   last_received_rtp_system_time_ = now;
@@ -755,7 +754,7 @@
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
 
   // Store playout timestamp for the received RTCP packet
-  UpdatePlayoutTimestamp(true, Timestamp::Millis(TimeMillis()));
+  UpdatePlayoutTimestamp(true, env_.clock().CurrentTime());
 
   // Deliver RTCP packet to RTP/RTCP module for parsing
   rtp_rtcp_->IncomingRtcpPacket(MakeArrayView(data, length));
diff --git a/audio/channel_receive_unittest.cc b/audio/channel_receive_unittest.cc
index 56161d3..edac932 100644
--- a/audio/channel_receive_unittest.cc
+++ b/audio/channel_receive_unittest.cc
@@ -38,7 +38,6 @@
 #include "modules/rtp_rtcp/source/rtp_packet_received.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/string_encode.h"
-#include "rtc_base/time_utils.h"
 #include "system_wrappers/include/ntp_time.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
@@ -92,7 +91,8 @@
 
   uint32_t RtpNow() {
     // Note - the "random" offset of this timestamp is zero.
-    return TimeMillis() * 1000 / kSampleRateHz;
+    return time_controller_.GetClock()->TimeInMilliseconds() * 1000 /
+           kSampleRateHz;
   }
 
   RtpPacketReceived CreateRtpPacket() {