Mark |Clock*| as |const Clock*| (for some CongestionController and BWE related modules)

BUG=None

Review-Url: https://codereview.webrtc.org/2735423002
Cr-Commit-Position: refs/heads/master@{#17148}
This commit is contained in:
elad.alon 2017-03-09 07:09:31 -08:00 committed by Commit bot
parent b5feb2e025
commit 61ce37e2e0
23 changed files with 45 additions and 43 deletions

View File

@ -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),

View File

@ -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_);

View File

@ -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),

View File

@ -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_;

View File

@ -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() {}

View File

@ -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,

View File

@ -230,7 +230,7 @@ rtc::Optional<uint32_t> DelayBasedBwe::BitrateEstimator::bitrate_bps() const {
return rtc::Optional<uint32_t>(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),

View File

@ -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<InterArrival> inter_arrival_;
std::unique_ptr<OveruseEstimator> kalman_estimator_;
std::unique_ptr<TrendlineEstimator> trendline_estimator_;

View File

@ -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<RemoteBitrateEstimator> 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_;

View File

@ -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();
}

View File

@ -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_);

View File

@ -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),

View File

@ -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,

View File

@ -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<ssrc, std::set<seq_no> >, for checking duplicates.
typedef std::map<uint32_t, std::set<uint16_t> > 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()),

View File

@ -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<AlrDetector> alr_detector_ GUARDED_BY(critsect_);

View File

@ -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<int64_t, PacketFeedback> history_;

View File

@ -81,7 +81,7 @@ bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds(
RemoteBitrateEstimatorAbsSendTime::RemoteBitrateEstimatorAbsSendTime(
RemoteBitrateObserver* observer,
Clock* clock)
const Clock* clock)
: clock_(clock),
observer_(observer),
inter_arrival_(),

View File

@ -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<InterArrival> inter_arrival_;
std::unique_ptr<OveruseEstimator> estimator_;

View File

@ -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),

View File

@ -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());

View File

@ -33,7 +33,7 @@ const int RemoteEstimatorProxy::kDefaultSendIntervalMs = 100;
static constexpr int64_t kMaxTimeMs =
std::numeric_limits<int64_t>::max() / 1000;
RemoteEstimatorProxy::RemoteEstimatorProxy(Clock* clock,
RemoteEstimatorProxy::RemoteEstimatorProxy(const Clock* clock,
PacketRouter* packet_router)
: clock_(clock),
packet_router_(packet_router),

View File

@ -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_;

View File

@ -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() {}