Use backticks not vertical bars to denote variables in comments for /modules/pacing
Bug: webrtc:12338 Change-Id: Id3b5081cf73be31829d75d7ef34942c2259053da Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227096 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34674}
This commit is contained in:
parent
3754e7c7ad
commit
ee3e3fdfb6
@ -164,7 +164,7 @@ absl::optional<PacedPacketInfo> BitrateProber::CurrentCluster(Timestamp now) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Probe size is recommended based on the probe bitrate required. We choose
|
// Probe size is recommended based on the probe bitrate required. We choose
|
||||||
// a minimum of twice |kMinProbeDeltaMs| interval to allow scheduling to be
|
// a minimum of twice `kMinProbeDeltaMs` interval to allow scheduling to be
|
||||||
// feasible.
|
// feasible.
|
||||||
DataSize BitrateProber::RecommendedMinProbeSize() const {
|
DataSize BitrateProber::RecommendedMinProbeSize() const {
|
||||||
if (clusters_.empty()) {
|
if (clusters_.empty()) {
|
||||||
|
|||||||
@ -38,7 +38,7 @@ struct BitrateProberConfig {
|
|||||||
// Maximum amount of time each probe can be delayed.
|
// Maximum amount of time each probe can be delayed.
|
||||||
FieldTrialParameter<TimeDelta> max_probe_delay;
|
FieldTrialParameter<TimeDelta> max_probe_delay;
|
||||||
// If NextProbeTime() is called with a delay higher than specified by
|
// If NextProbeTime() is called with a delay higher than specified by
|
||||||
// |max_probe_delay|, abort it.
|
// `max_probe_delay`, abort it.
|
||||||
FieldTrialParameter<bool> abort_delayed_probes;
|
FieldTrialParameter<bool> abort_delayed_probes;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,14 +61,14 @@ class BitrateProber {
|
|||||||
// with.
|
// with.
|
||||||
void OnIncomingPacket(DataSize packet_size);
|
void OnIncomingPacket(DataSize packet_size);
|
||||||
|
|
||||||
// Create a cluster used to probe for |bitrate_bps| with |num_probes| number
|
// Create a cluster used to probe for `bitrate_bps` with `num_probes` number
|
||||||
// of probes.
|
// of probes.
|
||||||
void CreateProbeCluster(DataRate bitrate, Timestamp now, int cluster_id);
|
void CreateProbeCluster(DataRate bitrate, Timestamp now, int cluster_id);
|
||||||
|
|
||||||
// Returns the time at which the next probe should be sent to get accurate
|
// Returns the time at which the next probe should be sent to get accurate
|
||||||
// probing. If probing is not desired at this time, Timestamp::PlusInfinity()
|
// probing. If probing is not desired at this time, Timestamp::PlusInfinity()
|
||||||
// will be returned.
|
// will be returned.
|
||||||
// TODO(bugs.webrtc.org/11780): Remove |now| argument when old mode is gone.
|
// TODO(bugs.webrtc.org/11780): Remove `now` argument when old mode is gone.
|
||||||
Timestamp NextProbeTime(Timestamp now) const;
|
Timestamp NextProbeTime(Timestamp now) const;
|
||||||
|
|
||||||
// Information about the current probing cluster.
|
// Information about the current probing cluster.
|
||||||
@ -80,7 +80,7 @@ class BitrateProber {
|
|||||||
|
|
||||||
// Called to report to the prober that a probe has been sent. In case of
|
// Called to report to the prober that a probe has been sent. In case of
|
||||||
// multiple packets per probe, this call would be made at the end of sending
|
// multiple packets per probe, this call would be made at the end of sending
|
||||||
// the last packet in probe. |size| is the total size of all packets in probe.
|
// the last packet in probe. `size` is the total size of all packets in probe.
|
||||||
void ProbeSent(Timestamp now, DataSize size);
|
void ProbeSent(Timestamp now, DataSize size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class PacedSender : public Module,
|
|||||||
// overshoots from the encoder.
|
// overshoots from the encoder.
|
||||||
static const float kDefaultPaceMultiplier;
|
static const float kDefaultPaceMultiplier;
|
||||||
|
|
||||||
// TODO(bugs.webrtc.org/10937): Make the |process_thread| argument be non
|
// TODO(bugs.webrtc.org/10937): Make the `process_thread` argument be non
|
||||||
// optional once all callers have been updated.
|
// optional once all callers have been updated.
|
||||||
PacedSender(Clock* clock,
|
PacedSender(Clock* clock,
|
||||||
PacketRouter* packet_router,
|
PacketRouter* packet_router,
|
||||||
|
|||||||
@ -346,7 +346,7 @@ Timestamp PacingController::NextSendTime() const {
|
|||||||
// If probing is active, that always takes priority.
|
// If probing is active, that always takes priority.
|
||||||
if (prober_.is_probing()) {
|
if (prober_.is_probing()) {
|
||||||
Timestamp probe_time = prober_.NextProbeTime(now);
|
Timestamp probe_time = prober_.NextProbeTime(now);
|
||||||
// |probe_time| == PlusInfinity indicates no probe scheduled.
|
// `probe_time` == PlusInfinity indicates no probe scheduled.
|
||||||
if (probe_time != Timestamp::PlusInfinity() && !probing_send_failure_) {
|
if (probe_time != Timestamp::PlusInfinity() && !probing_send_failure_) {
|
||||||
return probe_time;
|
return probe_time;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class PacingController {
|
|||||||
// Increasing this factor will result in lower delays in cases of bitrate
|
// Increasing this factor will result in lower delays in cases of bitrate
|
||||||
// overshoots from the encoder.
|
// overshoots from the encoder.
|
||||||
static const float kDefaultPaceMultiplier;
|
static const float kDefaultPaceMultiplier;
|
||||||
// If no media or paused, wake up at least every |kPausedProcessIntervalMs| in
|
// If no media or paused, wake up at least every `kPausedProcessIntervalMs` in
|
||||||
// order to send a keep-alive packet so we don't get stuck in a bad state due
|
// order to send a keep-alive packet so we don't get stuck in a bad state due
|
||||||
// to lack of feedback.
|
// to lack of feedback.
|
||||||
static const TimeDelta kPausedProcessInterval;
|
static const TimeDelta kPausedProcessInterval;
|
||||||
@ -192,11 +192,11 @@ class PacingController {
|
|||||||
DataSize transport_overhead_per_packet_;
|
DataSize transport_overhead_per_packet_;
|
||||||
|
|
||||||
// TODO(webrtc:9716): Remove this when we are certain clocks are monotonic.
|
// TODO(webrtc:9716): Remove this when we are certain clocks are monotonic.
|
||||||
// The last millisecond timestamp returned by |clock_|.
|
// The last millisecond timestamp returned by `clock_`.
|
||||||
mutable Timestamp last_timestamp_;
|
mutable Timestamp last_timestamp_;
|
||||||
bool paused_;
|
bool paused_;
|
||||||
|
|
||||||
// If |use_interval_budget_| is true, |media_budget_| and |padding_budget_|
|
// If `use_interval_budget_` is true, `media_budget_` and `padding_budget_`
|
||||||
// will be used to track when packets can be sent. Otherwise the media and
|
// will be used to track when packets can be sent. Otherwise the media and
|
||||||
// padding debt counters will be used together with the target rates.
|
// padding debt counters will be used together with the target rates.
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class PacketRouter : public PacingController::PacketSender {
|
|||||||
// Send REMB feedback.
|
// Send REMB feedback.
|
||||||
void SendRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs);
|
void SendRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs);
|
||||||
|
|
||||||
// Sends |packets| in one or more IP packets.
|
// Sends `packets` in one or more IP packets.
|
||||||
void SendCombinedRtcpPacket(
|
void SendCombinedRtcpPacket(
|
||||||
std::vector<std::unique_ptr<rtcp::RtcpPacket>> packets);
|
std::vector<std::unique_ptr<rtcp::RtcpPacket>> packets);
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ std::unique_ptr<RtpPacketToSend> RoundRobinPacketQueue::Pop() {
|
|||||||
stream_priorities_.erase(stream->priority_it);
|
stream_priorities_.erase(stream->priority_it);
|
||||||
|
|
||||||
// Calculate the total amount of time spent by this packet in the queue
|
// Calculate the total amount of time spent by this packet in the queue
|
||||||
// while in a non-paused state. Note that the |pause_time_sum_ms_| was
|
// while in a non-paused state. Note that the `pause_time_sum_ms_` was
|
||||||
// subtracted from |packet.enqueue_time_ms| when the packet was pushed, and
|
// subtracted from |packet.enqueue_time_ms| when the packet was pushed, and
|
||||||
// by subtracting it now we effectively remove the time spent in in the
|
// by subtracting it now we effectively remove the time spent in in the
|
||||||
// queue while in a paused state.
|
// queue while in a paused state.
|
||||||
@ -185,11 +185,11 @@ std::unique_ptr<RtpPacketToSend> RoundRobinPacketQueue::Pop() {
|
|||||||
RTC_CHECK(queued_packet.EnqueueTimeIterator() != enqueue_times_.end());
|
RTC_CHECK(queued_packet.EnqueueTimeIterator() != enqueue_times_.end());
|
||||||
enqueue_times_.erase(queued_packet.EnqueueTimeIterator());
|
enqueue_times_.erase(queued_packet.EnqueueTimeIterator());
|
||||||
|
|
||||||
// Update |bytes| of this stream. The general idea is that the stream that
|
// Update `bytes` of this stream. The general idea is that the stream that
|
||||||
// has sent the least amount of bytes should have the highest priority.
|
// has sent the least amount of bytes should have the highest priority.
|
||||||
// The problem with that is if streams send with different rates, in which
|
// The problem with that is if streams send with different rates, in which
|
||||||
// case a "budget" will be built up for the stream sending at the lower
|
// case a "budget" will be built up for the stream sending at the lower
|
||||||
// rate. To avoid building a too large budget we limit |bytes| to be within
|
// rate. To avoid building a too large budget we limit `bytes` to be within
|
||||||
// kMaxLeading bytes of the stream that has sent the most amount of bytes.
|
// kMaxLeading bytes of the stream that has sent the most amount of bytes.
|
||||||
DataSize packet_size = PacketSize(queued_packet);
|
DataSize packet_size = PacketSize(queued_packet);
|
||||||
stream->size =
|
stream->size =
|
||||||
@ -331,13 +331,13 @@ void RoundRobinPacketQueue::Push(QueuedPacket packet) {
|
|||||||
Stream* stream = &stream_info_it->second;
|
Stream* stream = &stream_info_it->second;
|
||||||
|
|
||||||
if (stream->priority_it == stream_priorities_.end()) {
|
if (stream->priority_it == stream_priorities_.end()) {
|
||||||
// If the SSRC is not currently scheduled, add it to |stream_priorities_|.
|
// If the SSRC is not currently scheduled, add it to `stream_priorities_`.
|
||||||
RTC_CHECK(!IsSsrcScheduled(stream->ssrc));
|
RTC_CHECK(!IsSsrcScheduled(stream->ssrc));
|
||||||
stream->priority_it = stream_priorities_.emplace(
|
stream->priority_it = stream_priorities_.emplace(
|
||||||
StreamPrioKey(packet.Priority(), stream->size), packet.Ssrc());
|
StreamPrioKey(packet.Priority(), stream->size), packet.Ssrc());
|
||||||
} else if (packet.Priority() < stream->priority_it->first.priority) {
|
} else if (packet.Priority() < stream->priority_it->first.priority) {
|
||||||
// If the priority of this SSRC increased, remove the outdated StreamPrioKey
|
// If the priority of this SSRC increased, remove the outdated StreamPrioKey
|
||||||
// and insert a new one with the new priority. Note that |priority_| uses
|
// and insert a new one with the new priority. Note that `priority_` uses
|
||||||
// lower ordinal for higher priority.
|
// lower ordinal for higher priority.
|
||||||
stream_priorities_.erase(stream->priority_it);
|
stream_priorities_.erase(stream->priority_it);
|
||||||
stream->priority_it = stream_priorities_.emplace(
|
stream->priority_it = stream_priorities_.emplace(
|
||||||
|
|||||||
@ -128,8 +128,8 @@ class RoundRobinPacketQueue {
|
|||||||
|
|
||||||
PriorityPacketQueue packet_queue;
|
PriorityPacketQueue packet_queue;
|
||||||
|
|
||||||
// Whenever a packet is inserted for this stream we check if |priority_it|
|
// Whenever a packet is inserted for this stream we check if `priority_it`
|
||||||
// points to an element in |stream_priorities_|, and if it does it means
|
// points to an element in `stream_priorities_`, and if it does it means
|
||||||
// this stream has already been scheduled, and if the scheduled priority is
|
// this stream has already been scheduled, and if the scheduled priority is
|
||||||
// lower than the priority of the incoming packet we reschedule this stream
|
// lower than the priority of the incoming packet we reschedule this stream
|
||||||
// with the higher priority.
|
// with the higher priority.
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class RtpPacketPacer {
|
|||||||
|
|
||||||
// Set the average upper bound on pacer queuing delay. The pacer may send at
|
// Set the average upper bound on pacer queuing delay. The pacer may send at
|
||||||
// a higher rate than what was configured via SetPacingRates() in order to
|
// a higher rate than what was configured via SetPacingRates() in order to
|
||||||
// keep ExpectedQueueTimeMs() below |limit_ms| on average.
|
// keep ExpectedQueueTimeMs() below `limit_ms` on average.
|
||||||
virtual void SetQueueTimeLimit(TimeDelta limit) = 0;
|
virtual void SetQueueTimeLimit(TimeDelta limit) = 0;
|
||||||
|
|
||||||
// Currently audio traffic is not accounted by pacer and passed through.
|
// Currently audio traffic is not accounted by pacer and passed through.
|
||||||
|
|||||||
@ -22,10 +22,10 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace {
|
namespace {
|
||||||
// If no calls to MaybeProcessPackets() happen, make sure we update stats
|
// If no calls to MaybeProcessPackets() happen, make sure we update stats
|
||||||
// at least every |kMaxTimeBetweenStatsUpdates| as long as the pacer isn't
|
// at least every `kMaxTimeBetweenStatsUpdates` as long as the pacer isn't
|
||||||
// completely drained.
|
// completely drained.
|
||||||
constexpr TimeDelta kMaxTimeBetweenStatsUpdates = TimeDelta::Millis(33);
|
constexpr TimeDelta kMaxTimeBetweenStatsUpdates = TimeDelta::Millis(33);
|
||||||
// Don't call UpdateStats() more than |kMinTimeBetweenStatsUpdates| apart,
|
// Don't call UpdateStats() more than `kMinTimeBetweenStatsUpdates` apart,
|
||||||
// for performance reasons.
|
// for performance reasons.
|
||||||
constexpr TimeDelta kMinTimeBetweenStatsUpdates = TimeDelta::Millis(1);
|
constexpr TimeDelta kMinTimeBetweenStatsUpdates = TimeDelta::Millis(1);
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -243,7 +243,7 @@ void TaskQueuePacedSender::MaybeProcessPackets(
|
|||||||
} else if (next_process_time_.IsMinusInfinity() ||
|
} else if (next_process_time_.IsMinusInfinity() ||
|
||||||
next_process_time <= next_process_time_ - hold_back_window_) {
|
next_process_time <= next_process_time_ - hold_back_window_) {
|
||||||
// Schedule a new task since there is none currently scheduled
|
// Schedule a new task since there is none currently scheduled
|
||||||
// (|next_process_time_| is infinite), or the new process time is at least
|
// (`next_process_time_` is infinite), or the new process time is at least
|
||||||
// one holdback window earlier than whatever is currently scheduled.
|
// one holdback window earlier than whatever is currently scheduled.
|
||||||
time_to_next_process = std::max(next_process_time - now, hold_back_window_);
|
time_to_next_process = std::max(next_process_time - now, hold_back_window_);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class RtcEventLog;
|
|||||||
|
|
||||||
class TaskQueuePacedSender : public RtpPacketPacer, public RtpPacketSender {
|
class TaskQueuePacedSender : public RtpPacketPacer, public RtpPacketSender {
|
||||||
public:
|
public:
|
||||||
// The |hold_back_window| parameter sets a lower bound on time to sleep if
|
// The `hold_back_window` parameter sets a lower bound on time to sleep if
|
||||||
// there is currently a pacer queue and packets can't immediately be
|
// there is currently a pacer queue and packets can't immediately be
|
||||||
// processed. Increasing this reduces thread wakeups at the expense of higher
|
// processed. Increasing this reduces thread wakeups at the expense of higher
|
||||||
// latency.
|
// latency.
|
||||||
@ -136,7 +136,7 @@ class TaskQueuePacedSender : public RtpPacketPacer, public RtpPacketSender {
|
|||||||
PacingController pacing_controller_ RTC_GUARDED_BY(task_queue_);
|
PacingController pacing_controller_ RTC_GUARDED_BY(task_queue_);
|
||||||
|
|
||||||
// We want only one (valid) delayed process task in flight at a time.
|
// We want only one (valid) delayed process task in flight at a time.
|
||||||
// If the value of |next_process_time_| is finite, it is an id for a
|
// If the value of `next_process_time_` is finite, it is an id for a
|
||||||
// delayed task that will call MaybeProcessPackets() with that time
|
// delayed task that will call MaybeProcessPackets() with that time
|
||||||
// as parameter.
|
// as parameter.
|
||||||
// Timestamp::MinusInfinity() indicates no valid pending task.
|
// Timestamp::MinusInfinity() indicates no valid pending task.
|
||||||
@ -144,7 +144,7 @@ class TaskQueuePacedSender : public RtpPacketPacer, public RtpPacketSender {
|
|||||||
|
|
||||||
// Since we don't want to support synchronous calls that wait for a
|
// Since we don't want to support synchronous calls that wait for a
|
||||||
// task execution, we poll the stats at some interval and update
|
// task execution, we poll the stats at some interval and update
|
||||||
// |current_stats_|, which can in turn be polled at any time.
|
// `current_stats_`, which can in turn be polled at any time.
|
||||||
|
|
||||||
// True iff there is delayed task in flight that that will call
|
// True iff there is delayed task in flight that that will call
|
||||||
// UdpateStats().
|
// UdpateStats().
|
||||||
|
|||||||
@ -424,7 +424,7 @@ namespace test {
|
|||||||
|
|
||||||
// At this point, the pace queue is drained so there is no more intersting
|
// At this point, the pace queue is drained so there is no more intersting
|
||||||
// update to be made - but there is still as schduled task that should run
|
// update to be made - but there is still as schduled task that should run
|
||||||
// |kMaxTimeBetweenStatsUpdates| after the first update.
|
// `kMaxTimeBetweenStatsUpdates` after the first update.
|
||||||
time_controller.AdvanceTime(start_time + kMaxTimeBetweenStatsUpdates -
|
time_controller.AdvanceTime(start_time + kMaxTimeBetweenStatsUpdates -
|
||||||
clock->CurrentTime());
|
clock->CurrentTime());
|
||||||
EXPECT_EQ(pacer.num_stats_updates_, ++num_expected_stats_updates);
|
EXPECT_EQ(pacer.num_stats_updates_, ++num_expected_stats_updates);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user