Removes all const Clock*.

This prepares for making the Clock interface fully mutable.

Calls to the time functions in Clock can have side effects in some
circumstances. It's also questionable if it's a good idea to allow
repeated calls to a const method return different values without
any changed to the class instance.

Bug: webrtc:9883
Change-Id: I96fb9230705f7c80a4c0702132fd9dc73899fc5e
Reviewed-on: https://webrtc-review.googlesource.com/c/120347
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26467}
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index 777d7f8..31e1334 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -35,7 +35,7 @@
 TargetRateConstraints ConvertConstraints(int min_bitrate_bps,
                                          int max_bitrate_bps,
                                          int start_bitrate_bps,
-                                         const Clock* clock) {
+                                         Clock* clock) {
   TargetRateConstraints msg;
   msg.at_time = Timestamp::ms(clock->TimeInMilliseconds());
   msg.min_data_rate =
@@ -48,7 +48,7 @@
 }
 
 TargetRateConstraints ConvertConstraints(const BitrateConstraints& contraints,
-                                         const Clock* clock) {
+                                         Clock* clock) {
   return ConvertConstraints(contraints.min_bitrate_bps,
                             contraints.max_bitrate_bps,
                             contraints.start_bitrate_bps, clock);
diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h
index deef040..c1b576e 100644
--- a/call/rtp_transport_controller_send.h
+++ b/call/rtp_transport_controller_send.h
@@ -133,7 +133,7 @@
   void PostUpdates(NetworkControlUpdate update) RTC_RUN_ON(task_queue_);
   void UpdateControlState() RTC_RUN_ON(task_queue_);
 
-  const Clock* const clock_;
+  Clock* const clock_;
   PacketRouter packet_router_;
   std::vector<std::unique_ptr<RtpVideoSenderInterface>> video_rtp_senders_;
   PacedSender pacer_;
diff --git a/modules/audio_coding/acm2/acm_receiver.h b/modules/audio_coding/acm2/acm_receiver.h
index d3b41c8..b5cb9a4 100644
--- a/modules/audio_coding/acm2/acm_receiver.h
+++ b/modules/audio_coding/acm2/acm_receiver.h
@@ -201,7 +201,7 @@
   std::unique_ptr<int16_t[]> last_audio_buffer_ RTC_GUARDED_BY(crit_sect_);
   CallStatistics call_stats_ RTC_GUARDED_BY(crit_sect_);
   const std::unique_ptr<NetEq> neteq_;  // NetEq is thread-safe; no lock needed.
-  const Clock* const clock_;
+  Clock* const clock_;
   bool resampled_last_output_frame_ RTC_GUARDED_BY(crit_sect_);
 };
 
diff --git a/modules/bitrate_controller/bitrate_controller_impl.cc b/modules/bitrate_controller/bitrate_controller_impl.cc
index 57c85f6..05d967b 100644
--- a/modules/bitrate_controller/bitrate_controller_impl.cc
+++ b/modules/bitrate_controller/bitrate_controller_impl.cc
@@ -54,19 +54,19 @@
 };
 
 BitrateController* BitrateController::CreateBitrateController(
-    const Clock* clock,
+    Clock* clock,
     BitrateObserver* observer,
     RtcEventLog* event_log) {
   return new BitrateControllerImpl(clock, observer, event_log);
 }
 
 BitrateController* BitrateController::CreateBitrateController(
-    const Clock* clock,
+    Clock* clock,
     RtcEventLog* event_log) {
   return CreateBitrateController(clock, nullptr, event_log);
 }
 
-BitrateControllerImpl::BitrateControllerImpl(const Clock* clock,
+BitrateControllerImpl::BitrateControllerImpl(Clock* clock,
                                              BitrateObserver* observer,
                                              RtcEventLog* event_log)
     : clock_(clock),
diff --git a/modules/bitrate_controller/bitrate_controller_impl.h b/modules/bitrate_controller/bitrate_controller_impl.h
index 5448c17..28dcc03 100644
--- a/modules/bitrate_controller/bitrate_controller_impl.h
+++ b/modules/bitrate_controller/bitrate_controller_impl.h
@@ -32,7 +32,7 @@
  public:
   // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
   // |observer| is left for project that is not yet updated.
-  BitrateControllerImpl(const Clock* clock,
+  BitrateControllerImpl(Clock* clock,
                         BitrateObserver* observer,
                         RtcEventLog* event_log);
   virtual ~BitrateControllerImpl() {}
@@ -83,7 +83,7 @@
                         int64_t rtt) RTC_EXCLUSIVE_LOCKS_REQUIRED(critsect_);
 
   // Used by process thread.
-  const Clock* const clock_;
+  Clock* const clock_;
   BitrateObserver* const observer_;
   int64_t last_bitrate_update_ms_;
   RtcEventLog* const event_log_;
diff --git a/modules/bitrate_controller/include/bitrate_controller.h b/modules/bitrate_controller/include/bitrate_controller.h
index 3e11fa7..c203d90 100644
--- a/modules/bitrate_controller/include/bitrate_controller.h
+++ b/modules/bitrate_controller/include/bitrate_controller.h
@@ -62,11 +62,11 @@
   // Deprecated:
   // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
   // Remove this method once other other projects does not use it.
-  static BitrateController* CreateBitrateController(const Clock* clock,
+  static BitrateController* CreateBitrateController(Clock* clock,
                                                     BitrateObserver* observer,
                                                     RtcEventLog* event_log);
 
-  static BitrateController* CreateBitrateController(const Clock* clock,
+  static BitrateController* CreateBitrateController(Clock* clock,
                                                     RtcEventLog* event_log);
 
   ~BitrateController() override {}
diff --git a/modules/congestion_controller/include/receive_side_congestion_controller.h b/modules/congestion_controller/include/receive_side_congestion_controller.h
index ad5d077..b021618 100644
--- a/modules/congestion_controller/include/receive_side_congestion_controller.h
+++ b/modules/congestion_controller/include/receive_side_congestion_controller.h
@@ -30,8 +30,7 @@
 class ReceiveSideCongestionController : public CallStatsObserver,
                                         public Module {
  public:
-  ReceiveSideCongestionController(const Clock* clock,
-                                  PacketRouter* packet_router);
+  ReceiveSideCongestionController(Clock* clock, PacketRouter* packet_router);
 
   ~ReceiveSideCongestionController() override {}
 
@@ -57,8 +56,7 @@
  private:
   class WrappingBitrateEstimator : public RemoteBitrateEstimator {
    public:
-    WrappingBitrateEstimator(RemoteBitrateObserver* observer,
-                             const Clock* clock);
+    WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock);
 
     ~WrappingBitrateEstimator() override;
 
@@ -84,7 +82,7 @@
         RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
     void PickEstimator() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
     RemoteBitrateObserver* observer_;
-    const Clock* const clock_;
+    Clock* const clock_;
     rtc::CriticalSection crit_sect_;
     std::unique_ptr<RemoteBitrateEstimator> rbe_;
     bool using_absolute_send_time_;
diff --git a/modules/congestion_controller/include/send_side_congestion_controller.h b/modules/congestion_controller/include/send_side_congestion_controller.h
index 545be0e..30c89dd 100644
--- a/modules/congestion_controller/include/send_side_congestion_controller.h
+++ b/modules/congestion_controller/include/send_side_congestion_controller.h
@@ -51,7 +51,7 @@
  public:
   using Observer = NetworkChangedObserver;
   DEPRECATED_SendSideCongestionController(
-      const Clock* clock,
+      Clock* clock,
       Observer* observer,
       RtcEventLog* event_log,
       PacedSender* pacer,
@@ -140,7 +140,7 @@
       RTC_EXCLUSIVE_LOCKS_REQUIRED(&probe_lock_);
   const FieldTrialBasedConfig field_trial_config_;
   const WebRtcKeyValueConfig* const key_value_config_;
-  const Clock* const clock_;
+  Clock* const clock_;
   rtc::CriticalSection observer_lock_;
   Observer* observer_ RTC_GUARDED_BY(observer_lock_);
   RtcEventLog* const event_log_;
diff --git a/modules/congestion_controller/receive_side_congestion_controller.cc b/modules/congestion_controller/receive_side_congestion_controller.cc
index c072e4c..224a49d 100644
--- a/modules/congestion_controller/receive_side_congestion_controller.cc
+++ b/modules/congestion_controller/receive_side_congestion_controller.cc
@@ -23,8 +23,7 @@
 }  // namespace
 
 ReceiveSideCongestionController::WrappingBitrateEstimator::
-    WrappingBitrateEstimator(RemoteBitrateObserver* observer,
-                             const Clock* clock)
+    WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock)
     : observer_(observer),
       clock_(clock),
       rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)),
@@ -120,7 +119,7 @@
 }
 
 ReceiveSideCongestionController::ReceiveSideCongestionController(
-    const Clock* clock,
+    Clock* clock,
     PacketRouter* packet_router)
     : remote_bitrate_estimator_(packet_router, clock),
       remote_estimator_proxy_(clock, packet_router) {}
diff --git a/modules/congestion_controller/send_side_congestion_controller.cc b/modules/congestion_controller/send_side_congestion_controller.cc
index af0b14f..f8b8dba 100644
--- a/modules/congestion_controller/send_side_congestion_controller.cc
+++ b/modules/congestion_controller/send_side_congestion_controller.cc
@@ -84,7 +84,7 @@
 
 DEPRECATED_SendSideCongestionController::
     DEPRECATED_SendSideCongestionController(
-        const Clock* clock,
+        Clock* clock,
         Observer* observer,
         RtcEventLog* event_log,
         PacedSender* pacer,
diff --git a/modules/congestion_controller/transport_feedback_adapter.cc b/modules/congestion_controller/transport_feedback_adapter.cc
index b58b0a9..5977fe5 100644
--- a/modules/congestion_controller/transport_feedback_adapter.cc
+++ b/modules/congestion_controller/transport_feedback_adapter.cc
@@ -29,8 +29,7 @@
     rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8);
 const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24);
 
-LegacyTransportFeedbackAdapter::LegacyTransportFeedbackAdapter(
-    const Clock* clock)
+LegacyTransportFeedbackAdapter::LegacyTransportFeedbackAdapter(Clock* clock)
     : send_time_history_(kSendTimeHistoryWindowMs),
       clock_(clock),
       current_offset_ms_(kNoTimestamp),
diff --git a/modules/congestion_controller/transport_feedback_adapter.h b/modules/congestion_controller/transport_feedback_adapter.h
index a8318f6..8ea5234 100644
--- a/modules/congestion_controller/transport_feedback_adapter.h
+++ b/modules/congestion_controller/transport_feedback_adapter.h
@@ -33,7 +33,7 @@
 // modules/congeestion_controller/rtp/transport_feedback_adapter.h
 class LegacyTransportFeedbackAdapter {
  public:
-  explicit LegacyTransportFeedbackAdapter(const Clock* clock);
+  explicit LegacyTransportFeedbackAdapter(Clock* clock);
   virtual ~LegacyTransportFeedbackAdapter();
 
   void RegisterPacketFeedbackObserver(PacketFeedbackObserver* observer);
@@ -64,7 +64,7 @@
 
   rtc::CriticalSection lock_;
   SendTimeHistory send_time_history_ RTC_GUARDED_BY(&lock_);
-  const Clock* const clock_;
+  Clock* const clock_;
   int64_t current_offset_ms_;
   int64_t last_timestamp_us_;
   std::vector<PacketFeedback> last_packet_feedback_vector_;
diff --git a/modules/pacing/paced_sender.cc b/modules/pacing/paced_sender.cc
index 9ab8cdb..a30aef0 100644
--- a/modules/pacing/paced_sender.cc
+++ b/modules/pacing/paced_sender.cc
@@ -42,7 +42,7 @@
 const int64_t PacedSender::kMaxQueueLengthMs = 2000;
 const float PacedSender::kDefaultPaceMultiplier = 2.5f;
 
-PacedSender::PacedSender(const Clock* clock,
+PacedSender::PacedSender(Clock* clock,
                          PacketSender* packet_sender,
                          RtcEventLog* event_log)
     : clock_(clock),
diff --git a/modules/pacing/paced_sender.h b/modules/pacing/paced_sender.h
index 0c7a90c..0ca5416 100644
--- a/modules/pacing/paced_sender.h
+++ b/modules/pacing/paced_sender.h
@@ -68,7 +68,7 @@
   // overshoots from the encoder.
   static const float kDefaultPaceMultiplier;
 
-  PacedSender(const Clock* clock,
+  PacedSender(Clock* clock,
               PacketSender* packet_sender,
               RtcEventLog* event_log);
 
@@ -168,7 +168,7 @@
   bool Congested() const RTC_EXCLUSIVE_LOCKS_REQUIRED(critsect_);
   int64_t TimeMilliseconds() const RTC_EXCLUSIVE_LOCKS_REQUIRED(critsect_);
 
-  const Clock* const clock_;
+  Clock* const clock_;
   PacketSender* const packet_sender_;
   std::unique_ptr<AlrDetector> alr_detector_ RTC_PT_GUARDED_BY(critsect_);
 
diff --git a/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
index 3f943cc..cb3a01c 100644
--- a/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
+++ b/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc
@@ -90,7 +90,7 @@
 
 RemoteBitrateEstimatorAbsSendTime::RemoteBitrateEstimatorAbsSendTime(
     RemoteBitrateObserver* observer,
-    const Clock* clock)
+    Clock* clock)
     : clock_(clock),
       observer_(observer),
       inter_arrival_(),
diff --git a/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h
index aee10ca..5403fca 100644
--- a/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h
+++ b/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h
@@ -73,7 +73,7 @@
 class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator {
  public:
   RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver* observer,
-                                    const Clock* clock);
+                                    Clock* clock);
   ~RemoteBitrateEstimatorAbsSendTime() override;
 
   void IncomingPacket(int64_t arrival_time_ms,
@@ -120,7 +120,7 @@
   void TimeoutStreams(int64_t now_ms) RTC_EXCLUSIVE_LOCKS_REQUIRED(&crit_);
 
   rtc::RaceChecker network_race_;
-  const Clock* const clock_;
+  Clock* const clock_;
   RemoteBitrateObserver* const observer_;
   std::unique_ptr<InterArrival> inter_arrival_;
   std::unique_ptr<OveruseEstimator> estimator_;
diff --git a/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
index a267051..b3c6786 100644
--- a/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
+++ b/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
@@ -59,7 +59,7 @@
 
 RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream(
     RemoteBitrateObserver* observer,
-    const Clock* clock)
+    Clock* clock)
     : clock_(clock),
       incoming_bitrate_(kBitrateWindowMs, 8000),
       last_valid_incoming_bitrate_(0),
diff --git a/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h b/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h
index ab54218..3f05c45 100644
--- a/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h
+++ b/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h
@@ -32,7 +32,7 @@
 class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
  public:
   RemoteBitrateEstimatorSingleStream(RemoteBitrateObserver* observer,
-                                     const Clock* clock);
+                                     Clock* clock);
   ~RemoteBitrateEstimatorSingleStream() override;
 
   void IncomingPacket(int64_t arrival_time_ms,
@@ -62,7 +62,7 @@
   // otherwise creates it.
   AimdRateControl* GetRemoteRate() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
 
-  const Clock* const clock_;
+  Clock* const clock_;
   SsrcOveruseEstimatorMap overuse_detectors_ RTC_GUARDED_BY(crit_sect_);
   RateStatistics incoming_bitrate_ RTC_GUARDED_BY(crit_sect_);
   uint32_t last_valid_incoming_bitrate_ RTC_GUARDED_BY(crit_sect_);
diff --git a/modules/remote_bitrate_estimator/remote_estimator_proxy.cc b/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
index d9745c9..9d9d27f 100644
--- a/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
+++ b/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
@@ -33,7 +33,7 @@
     std::numeric_limits<int64_t>::max() / 1000;
 
 RemoteEstimatorProxy::RemoteEstimatorProxy(
-    const Clock* clock,
+    Clock* clock,
     TransportFeedbackSenderInterface* feedback_sender)
     : clock_(clock),
       feedback_sender_(feedback_sender),
diff --git a/modules/remote_bitrate_estimator/remote_estimator_proxy.h b/modules/remote_bitrate_estimator/remote_estimator_proxy.h
index ed4e29b..db41a94 100644
--- a/modules/remote_bitrate_estimator/remote_estimator_proxy.h
+++ b/modules/remote_bitrate_estimator/remote_estimator_proxy.h
@@ -32,7 +32,7 @@
 
 class RemoteEstimatorProxy : public RemoteBitrateEstimator {
  public:
-  RemoteEstimatorProxy(const Clock* clock,
+  RemoteEstimatorProxy(Clock* clock,
                        TransportFeedbackSenderInterface* feedback_sender);
   ~RemoteEstimatorProxy() override;
 
@@ -58,7 +58,7 @@
       RTC_EXCLUSIVE_LOCKS_REQUIRED(&lock_);
   bool BuildFeedbackPacket(rtcp::TransportFeedback* feedback_packet);
 
-  const Clock* const clock_;
+  Clock* const clock_;
   TransportFeedbackSenderInterface* const feedback_sender_;
   int64_t last_process_time_ms_;
 
diff --git a/modules/remote_bitrate_estimator/test/bbr_paced_sender.cc b/modules/remote_bitrate_estimator/test/bbr_paced_sender.cc
index 9b80585..5ba384b 100644
--- a/modules/remote_bitrate_estimator/test/bbr_paced_sender.cc
+++ b/modules/remote_bitrate_estimator/test/bbr_paced_sender.cc
@@ -19,7 +19,7 @@
 
 namespace webrtc {
 
-BbrPacedSender::BbrPacedSender(const Clock* clock,
+BbrPacedSender::BbrPacedSender(Clock* clock,
                                PacedSender::PacketSender* packet_sender,
                                RtcEventLog* event_log)
     : clock_(clock),
diff --git a/modules/remote_bitrate_estimator/test/bbr_paced_sender.h b/modules/remote_bitrate_estimator/test/bbr_paced_sender.h
index 096f9d6..c782fd9 100644
--- a/modules/remote_bitrate_estimator/test/bbr_paced_sender.h
+++ b/modules/remote_bitrate_estimator/test/bbr_paced_sender.h
@@ -53,7 +53,7 @@
 struct Packet;
 class BbrPacedSender : public Pacer {
  public:
-  BbrPacedSender(const Clock* clock,
+  BbrPacedSender(Clock* clock,
                  PacedSender::PacketSender* packet_sender,
                  RtcEventLog* event_log);
   ~BbrPacedSender() override;
@@ -75,7 +75,7 @@
   bool TryToSendPacket(Packet* packet);
 
  private:
-  const Clock* const clock_;
+  Clock* const clock_;
   PacedSender::PacketSender* const packet_sender_;
   uint32_t estimated_bitrate_bps_;
   uint32_t min_send_bitrate_kbps_;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 63e9889..61adb31 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -323,7 +323,7 @@
   RTCPReceiver* rtcp_receiver() { return &rtcp_receiver_; }
   const RTCPReceiver* rtcp_receiver() const { return &rtcp_receiver_; }
 
-  const Clock* clock() const { return clock_; }
+  Clock* clock() const { return clock_; }
 
  private:
   FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, Rtt);
@@ -339,7 +339,7 @@
   RTCPSender rtcp_sender_;
   RTCPReceiver rtcp_receiver_;
 
-  const Clock* const clock_;
+  Clock* const clock_;
 
   const bool audio_;
 
diff --git a/modules/video_coding/jitter_estimator.cc b/modules/video_coding/jitter_estimator.cc
index 00d75da..424f86a 100644
--- a/modules/video_coding/jitter_estimator.cc
+++ b/modules/video_coding/jitter_estimator.cc
@@ -32,7 +32,7 @@
 static constexpr double kDefaultMaxTimestampDeviationInSigmas = 3.5;
 }  // namespace
 
-VCMJitterEstimator::VCMJitterEstimator(const Clock* clock,
+VCMJitterEstimator::VCMJitterEstimator(Clock* clock,
                                        int32_t vcmId,
                                        int32_t receiverId)
     : _vcmId(vcmId),
diff --git a/modules/video_coding/jitter_estimator.h b/modules/video_coding/jitter_estimator.h
index f163f4c..c6500da 100644
--- a/modules/video_coding/jitter_estimator.h
+++ b/modules/video_coding/jitter_estimator.h
@@ -20,9 +20,9 @@
 
 class VCMJitterEstimator {
  public:
-  VCMJitterEstimator(const Clock* clock,
-                     int32_t vcmId = 0,
-                     int32_t receiverId = 0);
+  explicit VCMJitterEstimator(Clock* clock,
+                              int32_t vcmId = 0,
+                              int32_t receiverId = 0);
   virtual ~VCMJitterEstimator();
   VCMJitterEstimator& operator=(const VCMJitterEstimator& rhs);
 
@@ -158,7 +158,7 @@
 
   rtc::RollingAccumulator<uint64_t> fps_counter_;
   const double time_deviation_upper_bound_;
-  const Clock* clock_;
+  Clock* clock_;
 };
 
 }  // namespace webrtc
diff --git a/rtc_base/rate_limiter.cc b/rtc_base/rate_limiter.cc
index 5c7bdef..7394c3e 100644
--- a/rtc_base/rate_limiter.cc
+++ b/rtc_base/rate_limiter.cc
@@ -17,7 +17,7 @@
 
 namespace webrtc {
 
-RateLimiter::RateLimiter(const Clock* clock, int64_t max_window_ms)
+RateLimiter::RateLimiter(Clock* clock, int64_t max_window_ms)
     : clock_(clock),
       current_rate_(max_window_ms, RateStatistics::kBpsScale),
       window_size_ms_(max_window_ms),
diff --git a/rtc_base/rate_limiter.h b/rtc_base/rate_limiter.h
index 7eaa946..1c956d7 100644
--- a/rtc_base/rate_limiter.h
+++ b/rtc_base/rate_limiter.h
@@ -28,7 +28,7 @@
 // methods will acquire (the same) lock befeore executing.
 class RateLimiter {
  public:
-  RateLimiter(const Clock* clock, int64_t max_window_ms);
+  RateLimiter(Clock* clock, int64_t max_window_ms);
   ~RateLimiter();
 
   // Try to use rate to send bytes. Returns true on success and if so updates
@@ -44,7 +44,7 @@
   bool SetWindowSize(int64_t window_size_ms);
 
  private:
-  const Clock* const clock_;
+  Clock* const clock_;
   rtc::CriticalSection lock_;
   RateStatistics current_rate_ RTC_GUARDED_BY(lock_);
   int64_t window_size_ms_ RTC_GUARDED_BY(lock_);
diff --git a/test/frame_generator_capturer.h b/test/frame_generator_capturer.h
index 15fee68..79a6d32 100644
--- a/test/frame_generator_capturer.h
+++ b/test/frame_generator_capturer.h
@@ -59,6 +59,7 @@
                                                       int frame_repeat_count,
                                                       int target_fps,
                                                       Clock* clock);
+
   static FrameGeneratorCapturer* Create(
       std::unique_ptr<FrameGenerator> frame_generator,
       int target_fps,
diff --git a/test/scenario/network_node.cc b/test/scenario/network_node.cc
index 316a46b..1f16105 100644
--- a/test/scenario/network_node.cc
+++ b/test/scenario/network_node.cc
@@ -78,7 +78,7 @@
       simulated_network_(simulation),
       config_(config) {}
 
-NetworkNodeTransport::NetworkNodeTransport(const Clock* sender_clock,
+NetworkNodeTransport::NetworkNodeTransport(Clock* sender_clock,
                                            Call* sender_call)
     : sender_clock_(sender_clock), sender_call_(sender_call) {}
 
diff --git a/test/scenario/network_node.h b/test/scenario/network_node.h
index cce1dd9..bdaf2fe 100644
--- a/test/scenario/network_node.h
+++ b/test/scenario/network_node.h
@@ -66,7 +66,7 @@
 
 class NetworkNodeTransport : public Transport {
  public:
-  NetworkNodeTransport(const Clock* sender_clock, Call* sender_call);
+  NetworkNodeTransport(Clock* sender_clock, Call* sender_call);
   ~NetworkNodeTransport() override;
 
   bool SendRtp(const uint8_t* packet,
@@ -85,7 +85,7 @@
 
  private:
   rtc::CriticalSection crit_sect_;
-  const Clock* const sender_clock_;
+  Clock* const sender_clock_;
   Call* const sender_call_;
   EmulatedNetworkNode* send_net_ RTC_GUARDED_BY(crit_sect_) = nullptr;
   uint64_t receiver_id_ RTC_GUARDED_BY(crit_sect_) = 0;
diff --git a/test/scenario/quality_stats.cc b/test/scenario/quality_stats.cc
index 863cf1f..3b2bb50 100644
--- a/test/scenario/quality_stats.cc
+++ b/test/scenario/quality_stats.cc
@@ -134,7 +134,7 @@
 }
 
 ForwardingCapturedFrameTap::ForwardingCapturedFrameTap(
-    const Clock* clock,
+    Clock* clock,
     VideoQualityAnalyzer* analyzer,
     rtc::VideoSourceInterface<VideoFrame>* source)
     : clock_(clock), analyzer_(analyzer), source_(source) {}
diff --git a/test/scenario/quality_stats.h b/test/scenario/quality_stats.h
index 18dc4f75..ece995c 100644
--- a/test/scenario/quality_stats.h
+++ b/test/scenario/quality_stats.h
@@ -41,7 +41,7 @@
   void OnDecodedFrame(const VideoFrame& frame);
   void Synchronize();
   bool Active() const;
-  const Clock* clock();
+  Clock* clock();
 
  private:
   int64_t DecodedFrameCaptureTimeOffsetMs(const VideoFrame& decoded) const;
@@ -73,7 +73,7 @@
     : public rtc::VideoSinkInterface<VideoFrame>,
       public rtc::VideoSourceInterface<VideoFrame> {
  public:
-  ForwardingCapturedFrameTap(const Clock* clock,
+  ForwardingCapturedFrameTap(Clock* clock,
                              VideoQualityAnalyzer* analyzer,
                              rtc::VideoSourceInterface<VideoFrame>* source);
   ForwardingCapturedFrameTap(ForwardingCapturedFrameTap&) = delete;
@@ -91,7 +91,7 @@
   VideoFrame PopFrame();
 
  private:
-  const Clock* clock_;
+  Clock* const clock_;
   VideoQualityAnalyzer* const analyzer_;
   rtc::VideoSourceInterface<VideoFrame>* const source_;
   VideoSinkInterface<VideoFrame>* sink_;