diff --git a/webrtc/base/rate_limiter.cc b/webrtc/base/rate_limiter.cc index 89bdb94e08..9215fa0c7f 100644 --- a/webrtc/base/rate_limiter.cc +++ b/webrtc/base/rate_limiter.cc @@ -13,7 +13,7 @@ namespace webrtc { -RateLimiter::RateLimiter(Clock* clock, int64_t max_window_ms) +RateLimiter::RateLimiter(const 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/webrtc/base/rate_limiter.h b/webrtc/base/rate_limiter.h index 5809fc125a..ceeccfc5a4 100644 --- a/webrtc/base/rate_limiter.h +++ b/webrtc/base/rate_limiter.h @@ -26,7 +26,7 @@ class Clock; // methods will acquire (the same) lock befeore executing. class RateLimiter { public: - RateLimiter(Clock* clock, int64_t max_window_ms); + RateLimiter(const Clock* clock, int64_t max_window_ms); ~RateLimiter(); // Try to use rate to send bytes. Returns true on success and if so updates @@ -42,7 +42,7 @@ class RateLimiter { bool SetWindowSize(int64_t window_size_ms); private: - Clock* const clock_; + const Clock* const clock_; rtc::CriticalSection lock_; RateStatistics current_rate_ GUARDED_BY(lock_); int64_t window_size_ms_ GUARDED_BY(lock_); diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc index f5be934e17..2d76cc99d9 100644 --- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc +++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc @@ -89,19 +89,19 @@ class BitrateControllerImpl::RtcpBandwidthObserverImpl }; BitrateController* BitrateController::CreateBitrateController( - Clock* clock, + const Clock* clock, BitrateObserver* observer, RtcEventLog* event_log) { return new BitrateControllerImpl(clock, observer, event_log); } BitrateController* BitrateController::CreateBitrateController( - Clock* clock, + const Clock* clock, RtcEventLog* event_log) { return CreateBitrateController(clock, nullptr, event_log); } -BitrateControllerImpl::BitrateControllerImpl(Clock* clock, +BitrateControllerImpl::BitrateControllerImpl(const Clock* clock, BitrateObserver* observer, RtcEventLog* event_log) : clock_(clock), diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_impl.h b/webrtc/modules/bitrate_controller/bitrate_controller_impl.h index 7ee6b19380..1a53e5d374 100644 --- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.h +++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.h @@ -31,7 +31,7 @@ class BitrateControllerImpl : public BitrateController { public: // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. // |observer| is left for project that is not yet updated. - BitrateControllerImpl(Clock* clock, + BitrateControllerImpl(const Clock* clock, BitrateObserver* observer, RtcEventLog* event_log); virtual ~BitrateControllerImpl() {} @@ -85,7 +85,7 @@ class BitrateControllerImpl : public BitrateController { int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); // Used by process thread. - Clock* const clock_; + const Clock* const clock_; BitrateObserver* const observer_; int64_t last_bitrate_update_ms_; RtcEventLog* const event_log_; diff --git a/webrtc/modules/bitrate_controller/include/bitrate_controller.h b/webrtc/modules/bitrate_controller/include/bitrate_controller.h index 032fec5fc7..36637a3dc0 100644 --- a/webrtc/modules/bitrate_controller/include/bitrate_controller.h +++ b/webrtc/modules/bitrate_controller/include/bitrate_controller.h @@ -54,11 +54,11 @@ class BitrateController : public Module { // 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(Clock* clock, + static BitrateController* CreateBitrateController(const Clock* clock, BitrateObserver* observer, RtcEventLog* event_log); - static BitrateController* CreateBitrateController(Clock* clock, + static BitrateController* CreateBitrateController(const Clock* clock, RtcEventLog* event_log); virtual ~BitrateController() {} diff --git a/webrtc/modules/congestion_controller/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc index 6ed64a299d..3c349399ce 100644 --- a/webrtc/modules/congestion_controller/congestion_controller.cc +++ b/webrtc/modules/congestion_controller/congestion_controller.cc @@ -48,7 +48,7 @@ static void ClampBitrates(int* bitrate_bps, } // namespace CongestionController::WrappingBitrateEstimator::WrappingBitrateEstimator( - RemoteBitrateObserver* observer, Clock* clock) + RemoteBitrateObserver* observer, const Clock* clock) : observer_(observer), clock_(clock), rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)), @@ -137,7 +137,7 @@ void CongestionController::WrappingBitrateEstimator::PickEstimator() { } CongestionController::CongestionController( - Clock* clock, + const Clock* clock, Observer* observer, RemoteBitrateObserver* remote_bitrate_observer, RtcEventLog* event_log, @@ -152,7 +152,7 @@ CongestionController::CongestionController( } CongestionController::CongestionController( - Clock* clock, + const Clock* clock, Observer* observer, RemoteBitrateObserver* remote_bitrate_observer, RtcEventLog* event_log, diff --git a/webrtc/modules/congestion_controller/delay_based_bwe.cc b/webrtc/modules/congestion_controller/delay_based_bwe.cc index b8fa341c22..1a22f357c7 100644 --- a/webrtc/modules/congestion_controller/delay_based_bwe.cc +++ b/webrtc/modules/congestion_controller/delay_based_bwe.cc @@ -230,7 +230,7 @@ rtc::Optional DelayBasedBwe::BitrateEstimator::bitrate_bps() const { return rtc::Optional(bitrate_estimate_ * 1000); } -DelayBasedBwe::DelayBasedBwe(RtcEventLog* event_log, Clock* clock) +DelayBasedBwe::DelayBasedBwe(RtcEventLog* event_log, const Clock* clock) : in_trendline_experiment_(TrendlineFilterExperimentIsEnabled()), in_median_slope_experiment_(MedianSlopeFilterExperimentIsEnabled()), event_log_(event_log), diff --git a/webrtc/modules/congestion_controller/delay_based_bwe.h b/webrtc/modules/congestion_controller/delay_based_bwe.h index c5f0f61828..5ae60f7d21 100644 --- a/webrtc/modules/congestion_controller/delay_based_bwe.h +++ b/webrtc/modules/congestion_controller/delay_based_bwe.h @@ -46,7 +46,7 @@ class DelayBasedBwe { uint32_t target_bitrate_bps; }; - DelayBasedBwe(RtcEventLog* event_log, Clock* clock); + DelayBasedBwe(RtcEventLog* event_log, const Clock* clock); virtual ~DelayBasedBwe() {} Result IncomingPacketFeedbackVector( @@ -94,7 +94,7 @@ class DelayBasedBwe { rtc::ThreadChecker network_thread_; RtcEventLog* const event_log_; - Clock* const clock_; + const Clock* const clock_; std::unique_ptr inter_arrival_; std::unique_ptr kalman_estimator_; std::unique_ptr trendline_estimator_; diff --git a/webrtc/modules/congestion_controller/include/congestion_controller.h b/webrtc/modules/congestion_controller/include/congestion_controller.h index 02f3e3429c..34547aa366 100644 --- a/webrtc/modules/congestion_controller/include/congestion_controller.h +++ b/webrtc/modules/congestion_controller/include/congestion_controller.h @@ -59,12 +59,12 @@ class CongestionController : public CallStatsObserver, protected: virtual ~Observer() {} }; - CongestionController(Clock* clock, + CongestionController(const Clock* clock, Observer* observer, RemoteBitrateObserver* remote_bitrate_observer, RtcEventLog* event_log, PacketRouter* packet_router); - CongestionController(Clock* clock, + CongestionController(const Clock* clock, Observer* observer, RemoteBitrateObserver* remote_bitrate_observer, RtcEventLog* event_log, @@ -129,7 +129,8 @@ class CongestionController : public CallStatsObserver, private: class WrappingBitrateEstimator : public RemoteBitrateEstimator { public: - WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock); + WrappingBitrateEstimator(RemoteBitrateObserver* observer, + const Clock* clock); virtual ~WrappingBitrateEstimator() {} @@ -155,7 +156,7 @@ class CongestionController : public CallStatsObserver, EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); void PickEstimator() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); RemoteBitrateObserver* observer_; - Clock* const clock_; + const Clock* const clock_; rtc::CriticalSection crit_sect_; std::unique_ptr rbe_; bool using_absolute_send_time_; @@ -172,7 +173,7 @@ class CongestionController : public CallStatsObserver, bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, uint8_t fraction_loss, int64_t rtt); - Clock* const clock_; + const Clock* const clock_; Observer* const observer_; RtcEventLog* const event_log_; PacketRouter* const packet_router_; diff --git a/webrtc/modules/congestion_controller/probe_controller.cc b/webrtc/modules/congestion_controller/probe_controller.cc index 654f8b98f4..52897eef36 100644 --- a/webrtc/modules/congestion_controller/probe_controller.cc +++ b/webrtc/modules/congestion_controller/probe_controller.cc @@ -47,7 +47,7 @@ constexpr int kRepeatedProbeMinPercentage = 70; } // namespace -ProbeController::ProbeController(PacedSender* pacer, Clock* clock) +ProbeController::ProbeController(PacedSender* pacer, const Clock* clock) : pacer_(pacer), clock_(clock), enable_periodic_alr_probing_(false) { Reset(); } diff --git a/webrtc/modules/congestion_controller/probe_controller.h b/webrtc/modules/congestion_controller/probe_controller.h index ccce7d3ec6..28cd10225f 100644 --- a/webrtc/modules/congestion_controller/probe_controller.h +++ b/webrtc/modules/congestion_controller/probe_controller.h @@ -26,7 +26,7 @@ class Clock; // bitrate is adjusted by an application. class ProbeController { public: - ProbeController(PacedSender* pacer, Clock* clock); + ProbeController(PacedSender* pacer, const Clock* clock); void SetBitrates(int64_t min_bitrate_bps, int64_t start_bitrate_bps, @@ -61,7 +61,7 @@ class ProbeController { rtc::CriticalSection critsect_; PacedSender* const pacer_; - Clock* const clock_; + const Clock* const clock_; NetworkState network_state_ GUARDED_BY(critsect_); State state_ GUARDED_BY(critsect_); int64_t min_bitrate_to_probe_further_bps_ GUARDED_BY(critsect_); diff --git a/webrtc/modules/congestion_controller/transport_feedback_adapter.cc b/webrtc/modules/congestion_controller/transport_feedback_adapter.cc index 3d1601cff8..7780024a86 100644 --- a/webrtc/modules/congestion_controller/transport_feedback_adapter.cc +++ b/webrtc/modules/congestion_controller/transport_feedback_adapter.cc @@ -25,7 +25,7 @@ const int64_t kBaseTimestampScaleFactor = rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8); const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24); -TransportFeedbackAdapter::TransportFeedbackAdapter(Clock* clock) +TransportFeedbackAdapter::TransportFeedbackAdapter(const Clock* clock) : send_side_bwe_with_overhead_( webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), transport_overhead_bytes_per_packet_(0), diff --git a/webrtc/modules/congestion_controller/transport_feedback_adapter.h b/webrtc/modules/congestion_controller/transport_feedback_adapter.h index 8a4856c980..628e5ce522 100644 --- a/webrtc/modules/congestion_controller/transport_feedback_adapter.h +++ b/webrtc/modules/congestion_controller/transport_feedback_adapter.h @@ -27,7 +27,7 @@ class TransportFeedback; class TransportFeedbackAdapter { public: - explicit TransportFeedbackAdapter(Clock* clock); + explicit TransportFeedbackAdapter(const Clock* clock); virtual ~TransportFeedbackAdapter(); void AddPacket(uint16_t sequence_number, diff --git a/webrtc/modules/pacing/paced_sender.cc b/webrtc/modules/pacing/paced_sender.cc index 658e13a9d3..3421d3a817 100644 --- a/webrtc/modules/pacing/paced_sender.cc +++ b/webrtc/modules/pacing/paced_sender.cc @@ -91,7 +91,7 @@ struct Comparator { // Class encapsulating a priority queue with some extensions. class PacketQueue { public: - explicit PacketQueue(Clock* clock) + explicit PacketQueue(const Clock* clock) : bytes_(0), clock_(clock), queue_time_sum_(0), @@ -196,7 +196,7 @@ class PacketQueue { // Map >, for checking duplicates. typedef std::map > SsrcSeqNoMap; SsrcSeqNoMap dupe_map_; - Clock* const clock_; + const Clock* const clock_; int64_t queue_time_sum_; int64_t time_last_updated_; }; @@ -246,7 +246,7 @@ class IntervalBudget { const int64_t PacedSender::kMaxQueueLengthMs = 2000; const float PacedSender::kDefaultPaceMultiplier = 2.5f; -PacedSender::PacedSender(Clock* clock, PacketSender* packet_sender) +PacedSender::PacedSender(const Clock* clock, PacketSender* packet_sender) : clock_(clock), packet_sender_(packet_sender), alr_detector_(new AlrDetector()), diff --git a/webrtc/modules/pacing/paced_sender.h b/webrtc/modules/pacing/paced_sender.h index 196d85afa1..ece462d836 100644 --- a/webrtc/modules/pacing/paced_sender.h +++ b/webrtc/modules/pacing/paced_sender.h @@ -68,7 +68,7 @@ class PacedSender : public Module, public RtpPacketSender { // overshoots from the encoder. static const float kDefaultPaceMultiplier; - PacedSender(Clock* clock, PacketSender* packet_sender); + PacedSender(const Clock* clock, PacketSender* packet_sender); virtual ~PacedSender(); @@ -152,7 +152,7 @@ class PacedSender : public Module, public RtpPacketSender { size_t SendPadding(size_t padding_needed, const PacedPacketInfo& cluster_info) EXCLUSIVE_LOCKS_REQUIRED(critsect_); - Clock* const clock_; + const Clock* const clock_; PacketSender* const packet_sender_; std::unique_ptr alr_detector_ GUARDED_BY(critsect_); diff --git a/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h b/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h index e0ed6bff70..d26ea8b657 100644 --- a/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h +++ b/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h @@ -23,7 +23,7 @@ struct PacketFeedback; class SendTimeHistory { public: - SendTimeHistory(Clock* clock, int64_t packet_age_limit_ms); + SendTimeHistory(const Clock* clock, int64_t packet_age_limit_ms); ~SendTimeHistory(); void Clear(); @@ -43,7 +43,7 @@ class SendTimeHistory { bool GetFeedback(PacketFeedback* packet_feedback, bool remove); private: - Clock* const clock_; + const Clock* const clock_; const int64_t packet_age_limit_ms_; SequenceNumberUnwrapper seq_num_unwrapper_; std::map history_; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc index ea70619eea..0eb3165f41 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc @@ -81,7 +81,7 @@ bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds( RemoteBitrateEstimatorAbsSendTime::RemoteBitrateEstimatorAbsSendTime( RemoteBitrateObserver* observer, - Clock* clock) + const Clock* clock) : clock_(clock), observer_(observer), inter_arrival_(), diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h index f88a2fc032..08f63e2150 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h @@ -69,7 +69,7 @@ struct Cluster { class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { public: RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver* observer, - Clock* clock); + const Clock* clock); virtual ~RemoteBitrateEstimatorAbsSendTime() {} void IncomingPacket(int64_t arrival_time_ms, @@ -115,7 +115,7 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { void TimeoutStreams(int64_t now_ms) EXCLUSIVE_LOCKS_REQUIRED(&crit_); rtc::ThreadChecker network_thread_; - Clock* const clock_; + const Clock* const clock_; RemoteBitrateObserver* const observer_; std::unique_ptr inter_arrival_; std::unique_ptr estimator_; diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc index 7b4cc2b7fd..56ac85ab93 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc @@ -47,7 +47,7 @@ struct RemoteBitrateEstimatorSingleStream::Detector { RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream( RemoteBitrateObserver* observer, - Clock* clock) + const Clock* clock) : clock_(clock), incoming_bitrate_(kBitrateWindowMs, 8000), last_valid_incoming_bitrate_(0), diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h index b893f56ed1..610d961e95 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h @@ -26,7 +26,7 @@ namespace webrtc { class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator { public: RemoteBitrateEstimatorSingleStream(RemoteBitrateObserver* observer, - Clock* clock); + const Clock* clock); virtual ~RemoteBitrateEstimatorSingleStream(); void IncomingPacket(int64_t arrival_time_ms, @@ -56,7 +56,7 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator { // otherwise creates it. AimdRateControl* GetRemoteRate() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()); - Clock* const clock_; + const Clock* const clock_; SsrcOveruseEstimatorMap overuse_detectors_ GUARDED_BY(crit_sect_.get()); RateStatistics incoming_bitrate_ GUARDED_BY(crit_sect_.get()); uint32_t last_valid_incoming_bitrate_ GUARDED_BY(crit_sect_.get()); diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc index 241c7d78a1..74d2ee1025 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc @@ -33,7 +33,7 @@ const int RemoteEstimatorProxy::kDefaultSendIntervalMs = 100; static constexpr int64_t kMaxTimeMs = std::numeric_limits::max() / 1000; -RemoteEstimatorProxy::RemoteEstimatorProxy(Clock* clock, +RemoteEstimatorProxy::RemoteEstimatorProxy(const Clock* clock, PacketRouter* packet_router) : clock_(clock), packet_router_(packet_router), diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h index c6931515e1..83ae078445 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h @@ -32,7 +32,7 @@ class TransportFeedback; class RemoteEstimatorProxy : public RemoteBitrateEstimator { public: - RemoteEstimatorProxy(Clock* clock, PacketRouter* packet_router); + RemoteEstimatorProxy(const Clock* clock, PacketRouter* packet_router); virtual ~RemoteEstimatorProxy(); void IncomingPacket(int64_t arrival_time_ms, @@ -57,7 +57,7 @@ class RemoteEstimatorProxy : public RemoteBitrateEstimator { EXCLUSIVE_LOCKS_REQUIRED(&lock_); bool BuildFeedbackPacket(rtcp::TransportFeedback* feedback_packet); - Clock* const clock_; + const Clock* const clock_; PacketRouter* const packet_router_; int64_t last_process_time_ms_; diff --git a/webrtc/modules/remote_bitrate_estimator/send_time_history.cc b/webrtc/modules/remote_bitrate_estimator/send_time_history.cc index 9937234231..1c5ca12f5a 100644 --- a/webrtc/modules/remote_bitrate_estimator/send_time_history.cc +++ b/webrtc/modules/remote_bitrate_estimator/send_time_history.cc @@ -16,7 +16,8 @@ namespace webrtc { -SendTimeHistory::SendTimeHistory(Clock* clock, int64_t packet_age_limit_ms) +SendTimeHistory::SendTimeHistory(const Clock* clock, + int64_t packet_age_limit_ms) : clock_(clock), packet_age_limit_ms_(packet_age_limit_ms) {} SendTimeHistory::~SendTimeHistory() {}