Use backticks not vertical bars to denote variables in comments for /modules/congestion_controller
Bug: webrtc:12338 Change-Id: Id46786886f13266177dd7fa8f1fb30c097df1373 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227094 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34622}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
d00ce747c7
commit
6f4b4fa18b
@ -34,23 +34,23 @@ struct RobustThroughputEstimatorSettings {
|
|||||||
|
|
||||||
// The estimator handles delay spikes by removing the largest receive time
|
// The estimator handles delay spikes by removing the largest receive time
|
||||||
// gap, but this introduces some bias that may lead to overestimation when
|
// gap, but this introduces some bias that may lead to overestimation when
|
||||||
// there isn't any delay spike. If |reduce_bias| is true, we instead replace
|
// there isn't any delay spike. If `reduce_bias` is true, we instead replace
|
||||||
// the largest receive time gap by the second largest. This reduces the bias
|
// the largest receive time gap by the second largest. This reduces the bias
|
||||||
// at the cost of not completely removing the genuine delay spikes.
|
// at the cost of not completely removing the genuine delay spikes.
|
||||||
bool reduce_bias = true;
|
bool reduce_bias = true;
|
||||||
|
|
||||||
// If |assume_shared_link| is false, we ignore the size of the first packet
|
// If `assume_shared_link` is false, we ignore the size of the first packet
|
||||||
// when computing the receive rate. Otherwise, we remove half of the first
|
// when computing the receive rate. Otherwise, we remove half of the first
|
||||||
// and last packet's sizes.
|
// and last packet's sizes.
|
||||||
bool assume_shared_link = false;
|
bool assume_shared_link = false;
|
||||||
|
|
||||||
// The estimator window keeps at least |min_packets| packets and up to
|
// The estimator window keeps at least `min_packets` packets and up to
|
||||||
// kMaxPackets received during the last |window_duration|.
|
// kMaxPackets received during the last `window_duration`.
|
||||||
unsigned min_packets = 20;
|
unsigned min_packets = 20;
|
||||||
TimeDelta window_duration = TimeDelta::Millis(500);
|
TimeDelta window_duration = TimeDelta::Millis(500);
|
||||||
|
|
||||||
// The estimator window requires at least |initial_packets| packets received
|
// The estimator window requires at least `initial_packets` packets received
|
||||||
// over at least |initial_duration|.
|
// over at least `initial_duration`.
|
||||||
unsigned initial_packets = 20;
|
unsigned initial_packets = 20;
|
||||||
|
|
||||||
// If audio packets are included in allocation, but not in bandwidth
|
// If audio packets are included in allocation, but not in bandwidth
|
||||||
|
@ -96,7 +96,7 @@ void StreamGenerator::set_capacity_bps(int capacity_bps) {
|
|||||||
capacity_ = capacity_bps;
|
capacity_ = capacity_bps;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Divides |bitrate_bps| among all streams. The allocated bitrate per stream
|
// Divides `bitrate_bps` among all streams. The allocated bitrate per stream
|
||||||
// is decided by the current allocation ratios.
|
// is decided by the current allocation ratios.
|
||||||
void StreamGenerator::SetBitrateBps(int bitrate_bps) {
|
void StreamGenerator::SetBitrateBps(int bitrate_bps) {
|
||||||
ASSERT_GE(streams_.size(), 0u);
|
ASSERT_GE(streams_.size(), 0u);
|
||||||
@ -253,8 +253,8 @@ bool DelayBasedBweTest::GenerateAndProcessFrame(uint32_t ssrc,
|
|||||||
return overuse;
|
return overuse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the bandwidth estimator with a stream of |number_of_frames| frames, or
|
// Run the bandwidth estimator with a stream of `number_of_frames` frames, or
|
||||||
// until it reaches |target_bitrate|.
|
// until it reaches `target_bitrate`.
|
||||||
// Can for instance be used to run the estimator for some time to get it
|
// Can for instance be used to run the estimator for some time to get it
|
||||||
// into a steady state.
|
// into a steady state.
|
||||||
uint32_t DelayBasedBweTest::SteadyStateRun(uint32_t ssrc,
|
uint32_t DelayBasedBweTest::SteadyStateRun(uint32_t ssrc,
|
||||||
@ -265,7 +265,7 @@ uint32_t DelayBasedBweTest::SteadyStateRun(uint32_t ssrc,
|
|||||||
uint32_t target_bitrate) {
|
uint32_t target_bitrate) {
|
||||||
uint32_t bitrate_bps = start_bitrate;
|
uint32_t bitrate_bps = start_bitrate;
|
||||||
bool bitrate_update_seen = false;
|
bool bitrate_update_seen = false;
|
||||||
// Produce |number_of_frames| frames and give them to the estimator.
|
// Produce `number_of_frames` frames and give them to the estimator.
|
||||||
for (int i = 0; i < max_number_of_frames; ++i) {
|
for (int i = 0; i < max_number_of_frames; ++i) {
|
||||||
bool overuse = GenerateAndProcessFrame(ssrc, bitrate_bps);
|
bool overuse = GenerateAndProcessFrame(ssrc, bitrate_bps);
|
||||||
if (overuse) {
|
if (overuse) {
|
||||||
@ -476,7 +476,7 @@ void DelayBasedBweTest::TestTimestampGroupingTestHelper() {
|
|||||||
const int kTimestampGroupLength = 15;
|
const int kTimestampGroupLength = 15;
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
for (int j = 0; j < kTimestampGroupLength; ++j) {
|
for (int j = 0; j < kTimestampGroupLength; ++j) {
|
||||||
// Insert |kTimestampGroupLength| frames with just 1 timestamp ticks in
|
// Insert `kTimestampGroupLength` frames with just 1 timestamp ticks in
|
||||||
// between. Should be treated as part of the same group by the estimator.
|
// between. Should be treated as part of the same group by the estimator.
|
||||||
IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, 100);
|
IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, 100);
|
||||||
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs / kTimestampGroupLength);
|
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs / kTimestampGroupLength);
|
||||||
|
@ -89,11 +89,11 @@ class StreamGenerator {
|
|||||||
// Set the link capacity.
|
// Set the link capacity.
|
||||||
void set_capacity_bps(int capacity_bps);
|
void set_capacity_bps(int capacity_bps);
|
||||||
|
|
||||||
// Divides |bitrate_bps| among all streams. The allocated bitrate per stream
|
// Divides `bitrate_bps` among all streams. The allocated bitrate per stream
|
||||||
// is decided by the initial allocation ratios.
|
// is decided by the initial allocation ratios.
|
||||||
void SetBitrateBps(int bitrate_bps);
|
void SetBitrateBps(int bitrate_bps);
|
||||||
|
|
||||||
// Set the RTP timestamp offset for the stream identified by |ssrc|.
|
// Set the RTP timestamp offset for the stream identified by `ssrc`.
|
||||||
void set_rtp_timestamp_offset(uint32_t ssrc, uint32_t offset);
|
void set_rtp_timestamp_offset(uint32_t ssrc, uint32_t offset);
|
||||||
|
|
||||||
// TODO(holmer): Break out the channel simulation part from this class to make
|
// TODO(holmer): Break out the channel simulation part from this class to make
|
||||||
@ -138,8 +138,8 @@ class DelayBasedBweTest : public ::testing::TestWithParam<std::string> {
|
|||||||
// target bitrate after the call to this function.
|
// target bitrate after the call to this function.
|
||||||
bool GenerateAndProcessFrame(uint32_t ssrc, uint32_t bitrate_bps);
|
bool GenerateAndProcessFrame(uint32_t ssrc, uint32_t bitrate_bps);
|
||||||
|
|
||||||
// Run the bandwidth estimator with a stream of |number_of_frames| frames, or
|
// Run the bandwidth estimator with a stream of `number_of_frames` frames, or
|
||||||
// until it reaches |target_bitrate|.
|
// until it reaches `target_bitrate`.
|
||||||
// Can for instance be used to run the estimator for some time to get it
|
// Can for instance be used to run the estimator for some time to get it
|
||||||
// into a steady state.
|
// into a steady state.
|
||||||
uint32_t SteadyStateRun(uint32_t ssrc,
|
uint32_t SteadyStateRun(uint32_t ssrc,
|
||||||
|
@ -102,8 +102,8 @@ bool InterArrivalDelta::ComputeDeltas(Timestamp send_time,
|
|||||||
return calculated_deltas;
|
return calculated_deltas;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assumes that |timestamp| is not reordered compared to
|
// Assumes that `timestamp` is not reordered compared to
|
||||||
// |current_timestamp_group_|.
|
// `current_timestamp_group_`.
|
||||||
bool InterArrivalDelta::NewTimestampGroup(Timestamp arrival_time,
|
bool InterArrivalDelta::NewTimestampGroup(Timestamp arrival_time,
|
||||||
Timestamp send_time) const {
|
Timestamp send_time) const {
|
||||||
if (current_timestamp_group_.IsFirstPacket()) {
|
if (current_timestamp_group_.IsFirstPacket()) {
|
||||||
|
@ -38,12 +38,12 @@ class InterArrivalDelta {
|
|||||||
|
|
||||||
// This function returns true if a delta was computed, or false if the current
|
// This function returns true if a delta was computed, or false if the current
|
||||||
// group is still incomplete or if only one group has been completed.
|
// group is still incomplete or if only one group has been completed.
|
||||||
// |send_time| is the send time.
|
// `send_time` is the send time.
|
||||||
// |arrival_time| is the time at which the packet arrived.
|
// `arrival_time` is the time at which the packet arrived.
|
||||||
// |packet_size| is the size of the packet.
|
// `packet_size` is the size of the packet.
|
||||||
// |timestamp_delta| (output) is the computed send time delta.
|
// `timestamp_delta` (output) is the computed send time delta.
|
||||||
// |arrival_time_delta_ms| (output) is the computed arrival-time delta.
|
// `arrival_time_delta_ms` (output) is the computed arrival-time delta.
|
||||||
// |packet_size_delta| (output) is the computed size delta.
|
// `packet_size_delta` (output) is the computed size delta.
|
||||||
bool ComputeDeltas(Timestamp send_time,
|
bool ComputeDeltas(Timestamp send_time,
|
||||||
Timestamp arrival_time,
|
Timestamp arrival_time,
|
||||||
Timestamp system_time,
|
Timestamp system_time,
|
||||||
@ -73,7 +73,7 @@ class InterArrivalDelta {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Returns true if the last packet was the end of the current batch and the
|
// Returns true if the last packet was the end of the current batch and the
|
||||||
// packet with |send_time| is the first of a new batch.
|
// packet with `send_time` is the first of a new batch.
|
||||||
bool NewTimestampGroup(Timestamp arrival_time, Timestamp send_time) const;
|
bool NewTimestampGroup(Timestamp arrival_time, Timestamp send_time) const;
|
||||||
|
|
||||||
bool BelongsToBurst(Timestamp arrival_time, Timestamp send_time) const;
|
bool BelongsToBurst(Timestamp arrival_time, Timestamp send_time) const;
|
||||||
|
@ -119,14 +119,14 @@ absl::optional<DataRate> ProbeBitrateEstimator::HandleProbeAndEstimateBitrate(
|
|||||||
}
|
}
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
// Since the |send_interval| does not include the time it takes to actually
|
// Since the `send_interval` does not include the time it takes to actually
|
||||||
// send the last packet the size of the last sent packet should not be
|
// send the last packet the size of the last sent packet should not be
|
||||||
// included when calculating the send bitrate.
|
// included when calculating the send bitrate.
|
||||||
RTC_DCHECK_GT(cluster->size_total, cluster->size_last_send);
|
RTC_DCHECK_GT(cluster->size_total, cluster->size_last_send);
|
||||||
DataSize send_size = cluster->size_total - cluster->size_last_send;
|
DataSize send_size = cluster->size_total - cluster->size_last_send;
|
||||||
DataRate send_rate = send_size / send_interval;
|
DataRate send_rate = send_size / send_interval;
|
||||||
|
|
||||||
// Since the |receive_interval| does not include the time it takes to
|
// Since the `receive_interval` does not include the time it takes to
|
||||||
// actually receive the first packet the size of the first received packet
|
// actually receive the first packet the size of the first received packet
|
||||||
// should not be included when calculating the receive bitrate.
|
// should not be included when calculating the receive bitrate.
|
||||||
RTC_DCHECK_GT(cluster->size_total, cluster->size_first_receive);
|
RTC_DCHECK_GT(cluster->size_total, cluster->size_first_receive);
|
||||||
|
@ -45,7 +45,7 @@ class ProbeBitrateEstimator {
|
|||||||
DataSize size_total = DataSize::Zero();
|
DataSize size_total = DataSize::Zero();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Erases old cluster data that was seen before |timestamp|.
|
// Erases old cluster data that was seen before `timestamp`.
|
||||||
void EraseOldClusters(Timestamp timestamp);
|
void EraseOldClusters(Timestamp timestamp);
|
||||||
|
|
||||||
std::map<int, AggregatedCluster> clusters_;
|
std::map<int, AggregatedCluster> clusters_;
|
||||||
|
@ -38,7 +38,7 @@ constexpr int kMinProbeDurationMs = 15;
|
|||||||
// the measured results back.
|
// the measured results back.
|
||||||
constexpr int64_t kMaxWaitingTimeForProbingResultMs = 1000;
|
constexpr int64_t kMaxWaitingTimeForProbingResultMs = 1000;
|
||||||
|
|
||||||
// Value of |min_bitrate_to_probe_further_bps_| that indicates
|
// Value of `min_bitrate_to_probe_further_bps_` that indicates
|
||||||
// further probing is disabled.
|
// further probing is disabled.
|
||||||
constexpr int kExponentialProbingDisabled = 0;
|
constexpr int kExponentialProbingDisabled = 0;
|
||||||
|
|
||||||
@ -46,16 +46,16 @@ constexpr int kExponentialProbingDisabled = 0;
|
|||||||
// specify max bitrate.
|
// specify max bitrate.
|
||||||
constexpr int64_t kDefaultMaxProbingBitrateBps = 5000000;
|
constexpr int64_t kDefaultMaxProbingBitrateBps = 5000000;
|
||||||
|
|
||||||
// If the bitrate drops to a factor |kBitrateDropThreshold| or lower
|
// If the bitrate drops to a factor `kBitrateDropThreshold` or lower
|
||||||
// and we recover within |kBitrateDropTimeoutMs|, then we'll send
|
// and we recover within `kBitrateDropTimeoutMs`, then we'll send
|
||||||
// a probe at a fraction |kProbeFractionAfterDrop| of the original bitrate.
|
// a probe at a fraction `kProbeFractionAfterDrop` of the original bitrate.
|
||||||
constexpr double kBitrateDropThreshold = 0.66;
|
constexpr double kBitrateDropThreshold = 0.66;
|
||||||
constexpr int kBitrateDropTimeoutMs = 5000;
|
constexpr int kBitrateDropTimeoutMs = 5000;
|
||||||
constexpr double kProbeFractionAfterDrop = 0.85;
|
constexpr double kProbeFractionAfterDrop = 0.85;
|
||||||
|
|
||||||
// Timeout for probing after leaving ALR. If the bitrate drops significantly,
|
// Timeout for probing after leaving ALR. If the bitrate drops significantly,
|
||||||
// (as determined by the delay based estimator) and we leave ALR, then we will
|
// (as determined by the delay based estimator) and we leave ALR, then we will
|
||||||
// send a probe if we recover within |kLeftAlrTimeoutMs| ms.
|
// send a probe if we recover within `kLeftAlrTimeoutMs` ms.
|
||||||
constexpr int kAlrEndedTimeoutMs = 3000;
|
constexpr int kAlrEndedTimeoutMs = 3000;
|
||||||
|
|
||||||
// The expected uncertainty of probe result (as a fraction of the target probe
|
// The expected uncertainty of probe result (as a fraction of the target probe
|
||||||
@ -155,8 +155,8 @@ std::vector<ProbeClusterConfig> ProbeController::SetBitrates(
|
|||||||
start_bitrate_bps_ = min_bitrate_bps;
|
start_bitrate_bps_ = min_bitrate_bps;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The reason we use the variable |old_max_bitrate_pbs| is because we
|
// The reason we use the variable `old_max_bitrate_pbs` is because we
|
||||||
// need to set |max_bitrate_bps_| before we call InitiateProbing.
|
// need to set `max_bitrate_bps_` before we call InitiateProbing.
|
||||||
int64_t old_max_bitrate_bps = max_bitrate_bps_;
|
int64_t old_max_bitrate_bps = max_bitrate_bps_;
|
||||||
max_bitrate_bps_ = max_bitrate_bps;
|
max_bitrate_bps_ = max_bitrate_bps;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class ProbeController {
|
|||||||
void SetMaxBitrate(int64_t max_bitrate_bps);
|
void SetMaxBitrate(int64_t max_bitrate_bps);
|
||||||
|
|
||||||
// Resets the ProbeController to a state equivalent to as if it was just
|
// Resets the ProbeController to a state equivalent to as if it was just
|
||||||
// created EXCEPT for |enable_periodic_alr_probing_|.
|
// created EXCEPT for `enable_periodic_alr_probing_`.
|
||||||
void Reset(int64_t at_time_ms);
|
void Reset(int64_t at_time_ms);
|
||||||
|
|
||||||
ABSL_MUST_USE_RESULT std::vector<ProbeClusterConfig> Process(
|
ABSL_MUST_USE_RESULT std::vector<ProbeClusterConfig> Process(
|
||||||
|
@ -279,7 +279,7 @@ TEST_F(ProbeControllerTest, PeriodicProbingAfterReset) {
|
|||||||
kMaxBitrateBps, NowMs());
|
kMaxBitrateBps, NowMs());
|
||||||
EXPECT_EQ(probes.size(), 2u);
|
EXPECT_EQ(probes.size(), 2u);
|
||||||
|
|
||||||
// Make sure we use |kStartBitrateBps| as the estimated bitrate
|
// Make sure we use `kStartBitrateBps` as the estimated bitrate
|
||||||
// until SetEstimatedBitrate is called with an updated estimate.
|
// until SetEstimatedBitrate is called with an updated estimate.
|
||||||
clock_.AdvanceTimeMilliseconds(10000);
|
clock_.AdvanceTimeMilliseconds(10000);
|
||||||
probes = probe_controller_->Process(NowMs());
|
probes = probe_controller_->Process(NowMs());
|
||||||
|
@ -134,15 +134,15 @@ class SendSideBandwidthEstimation {
|
|||||||
// Gets the upper limit for the target bitrate. This is the minimum of the
|
// Gets the upper limit for the target bitrate. This is the minimum of the
|
||||||
// delay based limit, the receiver limit and the loss based controller limit.
|
// delay based limit, the receiver limit and the loss based controller limit.
|
||||||
DataRate GetUpperLimit() const;
|
DataRate GetUpperLimit() const;
|
||||||
// Prints a warning if |bitrate| if sufficiently long time has past since last
|
// Prints a warning if `bitrate` if sufficiently long time has past since last
|
||||||
// warning.
|
// warning.
|
||||||
void MaybeLogLowBitrateWarning(DataRate bitrate, Timestamp at_time);
|
void MaybeLogLowBitrateWarning(DataRate bitrate, Timestamp at_time);
|
||||||
// Stores an update to the event log if the loss rate has changed, the target
|
// Stores an update to the event log if the loss rate has changed, the target
|
||||||
// has changed, or sufficient time has passed since last stored event.
|
// has changed, or sufficient time has passed since last stored event.
|
||||||
void MaybeLogLossBasedEvent(Timestamp at_time);
|
void MaybeLogLossBasedEvent(Timestamp at_time);
|
||||||
|
|
||||||
// Cap |bitrate| to [min_bitrate_configured_, max_bitrate_configured_] and
|
// Cap `bitrate` to [min_bitrate_configured_, max_bitrate_configured_] and
|
||||||
// set |current_bitrate_| to the capped value and updates the event log.
|
// set `current_bitrate_` to the capped value and updates the event log.
|
||||||
void UpdateTargetBitrate(DataRate bitrate, Timestamp at_time);
|
void UpdateTargetBitrate(DataRate bitrate, Timestamp at_time);
|
||||||
// Applies lower and upper bounds to the current target rate.
|
// Applies lower and upper bounds to the current target rate.
|
||||||
// TODO(srte): This seems to be called even when limits haven't changed, that
|
// TODO(srte): This seems to be called even when limits haven't changed, that
|
||||||
|
@ -60,7 +60,7 @@ class ReceiveSideCongestionController : public CallStatsObserver,
|
|||||||
void OnBitrateChanged(int bitrate_bps);
|
void OnBitrateChanged(int bitrate_bps);
|
||||||
|
|
||||||
// Ensures the remote party is notified of the receive bitrate no larger than
|
// Ensures the remote party is notified of the receive bitrate no larger than
|
||||||
// |bitrate| using RTCP REMB.
|
// `bitrate` using RTCP REMB.
|
||||||
void SetMaxDesiredReceiveBitrate(DataRate bitrate);
|
void SetMaxDesiredReceiveBitrate(DataRate bitrate);
|
||||||
|
|
||||||
// Implements Module.
|
// Implements Module.
|
||||||
|
@ -28,9 +28,9 @@ namespace webrtc {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Helper to convert some time format to resolution used in absolute send time
|
// Helper to convert some time format to resolution used in absolute send time
|
||||||
// header extension, rounded upwards. |t| is the time to convert, in some
|
// header extension, rounded upwards. `t` is the time to convert, in some
|
||||||
// resolution. |denom| is the value to divide |t| by to get whole seconds,
|
// resolution. `denom` is the value to divide `t` by to get whole seconds,
|
||||||
// e.g. |denom| = 1000 if |t| is in milliseconds.
|
// e.g. `denom` = 1000 if `t` is in milliseconds.
|
||||||
uint32_t AbsSendTime(int64_t t, int64_t denom) {
|
uint32_t AbsSendTime(int64_t t, int64_t denom) {
|
||||||
return (((t << 18) + (denom >> 1)) / denom) & 0x00fffffful;
|
return (((t << 18) + (denom >> 1)) / denom) & 0x00fffffful;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class RembThrottler : public RemoteBitrateObserver {
|
|||||||
RembThrottler(RembSender remb_sender, Clock* clock);
|
RembThrottler(RembSender remb_sender, Clock* clock);
|
||||||
|
|
||||||
// Ensures the remote party is notified of the receive bitrate no larger than
|
// Ensures the remote party is notified of the receive bitrate no larger than
|
||||||
// |bitrate| using RTCP REMB.
|
// `bitrate` using RTCP REMB.
|
||||||
void SetMaxDesiredReceiveBitrate(DataRate bitrate);
|
void SetMaxDesiredReceiveBitrate(DataRate bitrate);
|
||||||
|
|
||||||
// Implements RemoteBitrateObserver;
|
// Implements RemoteBitrateObserver;
|
||||||
|
Reference in New Issue
Block a user