mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Use backticks not vertical bars to denote variables in comments for /modules/remote_bitrate_estimator
Bug: webrtc:12338 Change-Id: Ib8b70186223699360e2323411e0c0ba1673bcb7d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227097 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34677}
This commit is contained in:
parent
5ce7d14f81
commit
1fd7af5fb8
14 changed files with 62 additions and 62 deletions
|
@ -47,18 +47,18 @@ class RemoteBitrateEstimator : public CallStatsObserver, public Module {
|
|||
|
||||
// Called for each incoming packet. Updates the incoming payload bitrate
|
||||
// estimate and the over-use detector. If an over-use is detected the
|
||||
// remote bitrate estimate will be updated. Note that |payload_size| is the
|
||||
// remote bitrate estimate will be updated. Note that `payload_size` is the
|
||||
// packet size excluding headers.
|
||||
// Note that |arrival_time_ms| can be of an arbitrary time base.
|
||||
// Note that `arrival_time_ms` can be of an arbitrary time base.
|
||||
virtual void IncomingPacket(int64_t arrival_time_ms,
|
||||
size_t payload_size,
|
||||
const RTPHeader& header) = 0;
|
||||
|
||||
// Removes all data for |ssrc|.
|
||||
// Removes all data for `ssrc`.
|
||||
virtual void RemoveStream(uint32_t ssrc) = 0;
|
||||
|
||||
// Returns true if a valid estimate exists and sets |bitrate_bps| to the
|
||||
// estimated payload bitrate in bits per second. |ssrcs| is the list of ssrcs
|
||||
// Returns true if a valid estimate exists and sets `bitrate_bps` to the
|
||||
// estimated payload bitrate in bits per second. `ssrcs` is the list of ssrcs
|
||||
// currently being received and of which the bitrate estimate is based upon.
|
||||
virtual bool LatestEstimate(std::vector<uint32_t>* ssrcs,
|
||||
uint32_t* bitrate_bps) const = 0;
|
||||
|
|
|
@ -119,8 +119,8 @@ bool InterArrival::PacketInOrder(uint32_t timestamp) {
|
|||
}
|
||||
}
|
||||
|
||||
// Assumes that |timestamp| is not reordered compared to
|
||||
// |current_timestamp_group_|.
|
||||
// Assumes that `timestamp` is not reordered compared to
|
||||
// `current_timestamp_group_`.
|
||||
bool InterArrival::NewTimestampGroup(int64_t arrival_time_ms,
|
||||
uint32_t timestamp) const {
|
||||
if (current_timestamp_group_.IsFirstPacket()) {
|
||||
|
|
|
@ -39,12 +39,12 @@ class InterArrival {
|
|||
|
||||
// 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.
|
||||
// |timestamp| is the timestamp.
|
||||
// |arrival_time_ms| is the local time at which the packet arrived.
|
||||
// |packet_size| is the size of the packet.
|
||||
// |timestamp_delta| (output) is the computed timestamp delta.
|
||||
// |arrival_time_delta_ms| (output) is the computed arrival-time delta.
|
||||
// |packet_size_delta| (output) is the computed size delta.
|
||||
// `timestamp` is the timestamp.
|
||||
// `arrival_time_ms` is the local time at which the packet arrived.
|
||||
// `packet_size` is the size of the packet.
|
||||
// `timestamp_delta` (output) is the computed timestamp delta.
|
||||
// `arrival_time_delta_ms` (output) is the computed arrival-time delta.
|
||||
// `packet_size_delta` (output) is the computed size delta.
|
||||
bool ComputeDeltas(uint32_t timestamp,
|
||||
int64_t arrival_time_ms,
|
||||
int64_t system_time_ms,
|
||||
|
@ -72,11 +72,11 @@ class InterArrival {
|
|||
int64_t last_system_time_ms;
|
||||
};
|
||||
|
||||
// Returns true if the packet with timestamp |timestamp| arrived in order.
|
||||
// Returns true if the packet with timestamp `timestamp` arrived in order.
|
||||
bool PacketInOrder(uint32_t timestamp);
|
||||
|
||||
// Returns true if the last packet was the end of the current batch and the
|
||||
// packet with |timestamp| is the first of a new batch.
|
||||
// packet with `timestamp` is the first of a new batch.
|
||||
bool NewTimestampGroup(int64_t arrival_time_ms, uint32_t timestamp) const;
|
||||
|
||||
bool BelongsToBurst(int64_t arrival_time_ms, uint32_t timestamp) const;
|
||||
|
|
|
@ -27,10 +27,10 @@ class OveruseDetector {
|
|||
virtual ~OveruseDetector();
|
||||
|
||||
// Update the detection state based on the estimated inter-arrival time delta
|
||||
// offset. |timestamp_delta| is the delta between the last timestamp which the
|
||||
// offset. `timestamp_delta` is the delta between the last timestamp which the
|
||||
// estimated offset is based on and the last timestamp on which the last
|
||||
// offset was based on, representing the time between detector updates.
|
||||
// |num_of_deltas| is the number of deltas the offset estimate is based on.
|
||||
// `num_of_deltas` is the number of deltas the offset estimate is based on.
|
||||
// Returns the state after the detection update.
|
||||
BandwidthUsage Detect(double offset,
|
||||
double timestamp_delta,
|
||||
|
|
|
@ -145,13 +145,13 @@ void OveruseEstimator::UpdateNoiseEstimate(double residual,
|
|||
return;
|
||||
}
|
||||
// Faster filter during startup to faster adapt to the jitter level
|
||||
// of the network. |alpha| is tuned for 30 frames per second, but is scaled
|
||||
// according to |ts_delta|.
|
||||
// of the network. `alpha` is tuned for 30 frames per second, but is scaled
|
||||
// according to `ts_delta`.
|
||||
double alpha = 0.01;
|
||||
if (num_of_deltas_ > 10 * 30) {
|
||||
alpha = 0.002;
|
||||
}
|
||||
// Only update the noise estimate if we're not over-using. |beta| is a
|
||||
// Only update the noise estimate if we're not over-using. `beta` is a
|
||||
// function of alpha and the time delta since the previous update.
|
||||
const double beta = pow(1 - alpha, ts_delta * 30.0 / 1000.0);
|
||||
avg_noise_ = beta * avg_noise_ + (1 - beta) * residual;
|
||||
|
|
|
@ -41,7 +41,7 @@ class OveruseEstimator {
|
|||
|
||||
// Update the estimator with a new sample. The deltas should represent deltas
|
||||
// between timestamp groups as defined by the InterArrival class.
|
||||
// |current_hypothesis| should be the hypothesis of the over-use detector at
|
||||
// `current_hypothesis` should be the hypothesis of the over-use detector at
|
||||
// this time.
|
||||
void Update(int64_t t_delta,
|
||||
double ts_delta,
|
||||
|
|
|
@ -181,7 +181,7 @@ void RemoteBitrateEstimatorSingleStream::UpdateEstimate(int64_t now_ms) {
|
|||
it->second->last_packet_time_ms;
|
||||
if (time_of_last_received_packet >= 0 &&
|
||||
now_ms - time_of_last_received_packet > kStreamTimeOutMs) {
|
||||
// This over-use detector hasn't received packets for |kStreamTimeOutMs|
|
||||
// This over-use detector hasn't received packets for `kStreamTimeOutMs`
|
||||
// milliseconds and is considered stale.
|
||||
delete it->second;
|
||||
overuse_detectors_.erase(it++);
|
||||
|
|
|
@ -65,7 +65,7 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
|
|||
void GetSsrcs(std::vector<uint32_t>* ssrcs) const
|
||||
RTC_SHARED_LOCKS_REQUIRED(mutex_);
|
||||
|
||||
// Returns |remote_rate_| if the pointed to object exists,
|
||||
// Returns `remote_rate_` if the pointed to object exists,
|
||||
// otherwise creates it.
|
||||
AimdRateControl* GetRemoteRate() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void StreamGenerator::set_capacity_bps(int 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.
|
||||
void StreamGenerator::SetBitrateBps(int bitrate_bps) {
|
||||
ASSERT_GE(streams_.size(), 0u);
|
||||
|
@ -164,7 +164,7 @@ void StreamGenerator::SetBitrateBps(int bitrate_bps) {
|
|||
EXPECT_EQ(total_bitrate_after, 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 StreamGenerator::set_rtp_timestamp_offset(uint32_t ssrc, uint32_t offset) {
|
||||
streams_[ssrc]->set_rtp_timestamp_offset(offset);
|
||||
}
|
||||
|
@ -279,8 +279,8 @@ bool RemoteBitrateEstimatorTest::GenerateAndProcessFrame(uint32_t ssrc,
|
|||
return overuse;
|
||||
}
|
||||
|
||||
// Run the bandwidth estimator with a stream of |number_of_frames| frames, or
|
||||
// until it reaches |target_bitrate|.
|
||||
// Run the bandwidth estimator with a stream of `number_of_frames` frames, or
|
||||
// until it reaches `target_bitrate`.
|
||||
// Can for instance be used to run the estimator for some time to get it
|
||||
// into a steady state.
|
||||
uint32_t RemoteBitrateEstimatorTest::SteadyStateRun(uint32_t ssrc,
|
||||
|
@ -291,7 +291,7 @@ uint32_t RemoteBitrateEstimatorTest::SteadyStateRun(uint32_t ssrc,
|
|||
uint32_t target_bitrate) {
|
||||
uint32_t bitrate_bps = start_bitrate;
|
||||
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) {
|
||||
bool overuse = GenerateAndProcessFrame(ssrc, bitrate_bps);
|
||||
if (overuse) {
|
||||
|
@ -554,7 +554,7 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
|
|||
const uint32_t kSingleRtpTickAbsSendTime = AbsSendTime(1, 90000);
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
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.
|
||||
IncomingPacket(kDefaultSsrc, 100, clock_.TimeInMilliseconds(), timestamp,
|
||||
absolute_send_time);
|
||||
|
|
|
@ -122,11 +122,11 @@ class StreamGenerator {
|
|||
// Set the link capacity.
|
||||
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.
|
||||
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);
|
||||
|
||||
// TODO(holmer): Break out the channel simulation part from this class to make
|
||||
|
@ -158,9 +158,9 @@ class RemoteBitrateEstimatorTest : public ::testing::Test {
|
|||
void AddDefaultStream();
|
||||
|
||||
// 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
|
||||
// resolution. |denom| is the value to divide |t| by to get whole seconds,
|
||||
// e.g. |denom| = 1000 if |t| is in milliseconds.
|
||||
// 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,
|
||||
// e.g. `denom` = 1000 if `t` is in milliseconds.
|
||||
static uint32_t AbsSendTime(int64_t t, int64_t denom);
|
||||
|
||||
// Helper to add two absolute send time values and keep it less than 1<<24.
|
||||
|
@ -183,8 +183,8 @@ class RemoteBitrateEstimatorTest : public ::testing::Test {
|
|||
// target bitrate after the call to this function.
|
||||
bool GenerateAndProcessFrame(uint32_t ssrc, uint32_t bitrate_bps);
|
||||
|
||||
// Run the bandwidth estimator with a stream of |number_of_frames| frames, or
|
||||
// until it reaches |target_bitrate|.
|
||||
// Run the bandwidth estimator with a stream of `number_of_frames` frames, or
|
||||
// until it reaches `target_bitrate`.
|
||||
// Can for instance be used to run the estimator for some time to get it
|
||||
// into a steady state.
|
||||
uint32_t SteadyStateRun(uint32_t ssrc,
|
||||
|
|
|
@ -179,7 +179,7 @@ void RemoteEstimatorProxy::SetSendPeriodicFeedback(
|
|||
}
|
||||
|
||||
void RemoteEstimatorProxy::SendPeriodicFeedbacks() {
|
||||
// |periodic_window_start_seq_| is the first sequence number to include in
|
||||
// `periodic_window_start_seq_` is the first sequence number to include in
|
||||
// the current feedback packet. Some older may still be in the map, in case
|
||||
// a reordering happens and we need to retransmit them.
|
||||
if (!periodic_window_start_seq_)
|
||||
|
|
|
@ -107,7 +107,7 @@ class RemoteEstimatorProxy : public RemoteBitrateEstimator {
|
|||
int64_t last_process_time_ms_;
|
||||
|
||||
Mutex lock_;
|
||||
// |network_state_estimator_| may be null.
|
||||
// `network_state_estimator_` may be null.
|
||||
NetworkStateEstimator* const network_state_estimator_
|
||||
RTC_PT_GUARDED_BY(&lock_);
|
||||
uint32_t media_ssrc_ RTC_GUARDED_BY(&lock_);
|
||||
|
|
|
@ -444,7 +444,7 @@ TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMinIntervalOn300kbps) {
|
|||
|
||||
TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMaxIntervalOn0kbps) {
|
||||
Process();
|
||||
// TimeUntilNextProcess should be limited by |kMaxSendIntervalMs| when
|
||||
// TimeUntilNextProcess should be limited by `kMaxSendIntervalMs` when
|
||||
// bitrate is small. We choose 0 bps as a special case, which also tests
|
||||
// erroneous behaviors like division-by-zero.
|
||||
proxy_.OnBitrateChanged(0);
|
||||
|
|
|
@ -53,31 +53,31 @@
|
|||
|
||||
// Set a thread-global base logging context. This name will be prepended to all
|
||||
// hierarchical contexts.
|
||||
// |name| is a char*, std::string or uint32_t to name the context.
|
||||
// `name` is a char*, std::string or uint32_t to name the context.
|
||||
#define BWE_TEST_LOGGING_GLOBAL_CONTEXT(name)
|
||||
|
||||
// Thread-globally allow/disallow logging.
|
||||
// |enable| is expected to be a bool.
|
||||
// `enable` is expected to be a bool.
|
||||
#define BWE_TEST_LOGGING_GLOBAL_ENABLE(enabled)
|
||||
|
||||
// Insert a (hierarchical) logging context.
|
||||
// |name| is a char*, std::string or uint32_t to name the context.
|
||||
// `name` is a char*, std::string or uint32_t to name the context.
|
||||
#define BWE_TEST_LOGGING_CONTEXT(name)
|
||||
|
||||
// Allow/disallow logging down the call tree from this point. Logging must be
|
||||
// enabled all the way to the root of the call tree to take place.
|
||||
// |enable| is expected to be a bool.
|
||||
// `enable` is expected to be a bool.
|
||||
#define BWE_TEST_LOGGING_ENABLE(enabled)
|
||||
|
||||
// Set current time (only affects PLOT output). Down the call tree, the latest
|
||||
// time set always takes precedence.
|
||||
// |time| is an int64_t time in ms, or -1 to inherit time from previous context.
|
||||
// `time` is an int64_t time in ms, or -1 to inherit time from previous context.
|
||||
#define BWE_TEST_LOGGING_TIME(time)
|
||||
|
||||
// Print to stdout, e.g.:
|
||||
// Context1_Context2_Name printf-formated-string
|
||||
// |name| is a char*, std::string or uint32_t to name the log line.
|
||||
// |format| is a printf format string.
|
||||
// `name` is a char*, std::string or uint32_t to name the log line.
|
||||
// `format` is a printf format string.
|
||||
// |_1...| are arguments for printf.
|
||||
#define BWE_TEST_LOGGING_LOG1(name, format, _1)
|
||||
#define BWE_TEST_LOGGING_LOG2(name, format, _1, _2)
|
||||
|
@ -87,12 +87,12 @@
|
|||
|
||||
// Print to stdout in tab-separated format suitable for plotting, e.g.:
|
||||
// PLOT figure Context1_Context2_Name time value
|
||||
// |figure| is a figure id. Different figures are plotted in different windows.
|
||||
// |name| is a char*, std::string or uint32_t to name the plotted value.
|
||||
// |time| is an int64_t time in ms, or -1 to inherit time from previous context.
|
||||
// |value| is a double precision float to be plotted.
|
||||
// |ssrc| identifies the source of a stream
|
||||
// |alg_name| is an optional argument, a string
|
||||
// `figure` is a figure id. Different figures are plotted in different windows.
|
||||
// `name` is a char*, std::string or uint32_t to name the plotted value.
|
||||
// `time` is an int64_t time in ms, or -1 to inherit time from previous context.
|
||||
// `value` is a double precision float to be plotted.
|
||||
// `ssrc` identifies the source of a stream
|
||||
// `alg_name` is an optional argument, a string
|
||||
#define BWE_TEST_LOGGING_PLOT(figure, name, time, value)
|
||||
#define BWE_TEST_LOGGING_PLOT_WITH_NAME(figure, name, time, value, alg_name)
|
||||
#define BWE_TEST_LOGGING_PLOT_WITH_SSRC(figure, name, time, value, ssrc)
|
||||
|
@ -101,13 +101,13 @@
|
|||
|
||||
// Print to stdout in tab-separated format suitable for plotting, e.g.:
|
||||
// BAR figure Context1_Context2_Name x_left width value
|
||||
// |figure| is a figure id. Different figures are plotted in different windows.
|
||||
// |name| is a char*, std::string or uint32_t to name the plotted value.
|
||||
// |value| is a double precision float to be plotted.
|
||||
// |ylow| and |yhigh| are double precision float for the error line.
|
||||
// |title| is a string and refers to the error label.
|
||||
// |ymax| is a double precision float for the limit horizontal line.
|
||||
// |limit_title| is a string and refers to the limit label.
|
||||
// `figure` is a figure id. Different figures are plotted in different windows.
|
||||
// `name` is a char*, std::string or uint32_t to name the plotted value.
|
||||
// `value` is a double precision float to be plotted.
|
||||
// `ylow` and `yhigh` are double precision float for the error line.
|
||||
// `title` is a string and refers to the error label.
|
||||
// `ymax` is a double precision float for the limit horizontal line.
|
||||
// `limit_title` is a string and refers to the limit label.
|
||||
#define BWE_TEST_LOGGING_BAR(figure, name, value, flow_id)
|
||||
#define BWE_TEST_LOGGING_ERRORBAR(figure, name, value, ylow, yhigh, \
|
||||
error_title, flow_id)
|
||||
|
@ -116,9 +116,9 @@
|
|||
|
||||
#define BWE_TEST_LOGGING_BASELINEBAR(figure, name, value, flow_id)
|
||||
|
||||
// |num_flows| is an integer refering to the number of RMCAT flows in the
|
||||
// `num_flows` is an integer refering to the number of RMCAT flows in the
|
||||
// scenario.
|
||||
// Define |x_label| and |y_label| for plots.
|
||||
// Define `x_label` and `y_label` for plots.
|
||||
#define BWE_TEST_LOGGING_LABEL(figure, x_label, y_label, num_flows)
|
||||
|
||||
#else // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
|
||||
|
@ -278,7 +278,7 @@ class Logging {
|
|||
void SetGlobalEnable(bool enabled);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Note: Implicit |this| argument counts as the first argument.
|
||||
// Note: Implicit `this` argument counts as the first argument.
|
||||
__attribute__((__format__(__printf__, 2, 3)))
|
||||
#endif
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue