aboutsummaryrefslogtreecommitdiff
path: root/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/congestion_controller/goog_cc/loss_based_bwe_v2.h')
-rw-r--r--modules/congestion_controller/goog_cc/loss_based_bwe_v2.h78
1 files changed, 44 insertions, 34 deletions
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
index cd49d05c97..228d5985f7 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
@@ -11,13 +11,11 @@
#ifndef MODULES_CONGESTION_CONTROLLER_GOOG_CC_LOSS_BASED_BWE_V2_H_
#define MODULES_CONGESTION_CONTROLLER_GOOG_CC_LOSS_BASED_BWE_V2_H_
-#include <deque>
#include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/field_trials_view.h"
-#include "api/network_state_predictor.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "api/units/data_size.h"
@@ -30,8 +28,12 @@ namespace webrtc {
// when network is loss limited, or equal to the delay based estimate.
enum class LossBasedState {
kIncreasing = 0,
- kDecreasing = 1,
- kDelayBasedEstimate = 2
+ // TODO(bugs.webrtc.org/12707): Remove one of the increasing states once we
+ // have decided if padding is usefull for ramping up when BWE is loss
+ // limited.
+ kIncreaseUsingPadding = 1,
+ kDecreasing = 2,
+ kDelayBasedEstimate = 3
};
class LossBasedBweV2 {
@@ -60,6 +62,9 @@ class LossBasedBweV2 {
// Returns true if loss based BWE is ready to be used in the start phase.
bool ReadyToUseInStartPhase() const;
+ // Returns true if loss based BWE can be used in the start phase.
+ bool UseInStartPhase() const;
+
// Returns `DataRate::PlusInfinity` if no BWE can be calculated.
Result GetLossBasedResult() const;
@@ -68,8 +73,6 @@ class LossBasedBweV2 {
void UpdateBandwidthEstimate(
rtc::ArrayView<const PacketResult> packet_results,
DataRate delay_based_estimate,
- BandwidthUsage delay_detector_state,
- absl::optional<DataRate> probe_bitrate,
bool in_alr);
// For unit testing only.
@@ -99,6 +102,7 @@ class LossBasedBweV2 {
double newton_step_size = 0.0;
bool append_acknowledged_rate_candidate = true;
bool append_delay_based_estimate_candidate = false;
+ bool append_upper_bound_candidate_in_alr = false;
TimeDelta observation_duration_lower_bound = TimeDelta::Zero();
int observation_window_size = 0;
double sending_rate_smoothing_factor = 0.0;
@@ -107,19 +111,19 @@ class LossBasedBweV2 {
double instant_upper_bound_loss_offset = 0.0;
double temporal_weight_factor = 0.0;
double bandwidth_backoff_lower_bound_factor = 0.0;
- bool trendline_integration_enabled = false;
- int trendline_observations_window_size = 0;
double max_increase_factor = 0.0;
TimeDelta delayed_increase_window = TimeDelta::Zero();
- bool use_acked_bitrate_only_when_overusing = false;
bool not_increase_if_inherent_loss_less_than_average_loss = false;
double high_loss_rate_threshold = 1.0;
DataRate bandwidth_cap_at_high_loss_rate = DataRate::MinusInfinity();
double slope_of_bwe_high_loss_func = 1000.0;
- bool probe_integration_enabled = false;
- TimeDelta probe_expiration = TimeDelta::Zero();
bool not_use_acked_rate_in_alr = false;
bool use_in_start_phase = false;
+ int min_num_observations = 0;
+ double lower_bound_by_acked_rate_factor = 0.0;
+ double hold_duration_factor = 0.0;
+ bool use_byte_loss_rate = false;
+ TimeDelta padding_duration = TimeDelta::Zero();
};
struct Derivatives {
@@ -134,6 +138,8 @@ class LossBasedBweV2 {
int num_lost_packets = 0;
int num_received_packets = 0;
DataRate sending_rate = DataRate::MinusInfinity();
+ DataSize size = DataSize::Zero();
+ DataSize lost_size = DataSize::Zero();
int id = -1;
};
@@ -141,6 +147,18 @@ class LossBasedBweV2 {
int num_packets = 0;
int num_lost_packets = 0;
DataSize size = DataSize::Zero();
+ DataSize lost_size = DataSize::Zero();
+ };
+
+ struct PaddingInfo {
+ DataRate padding_rate = DataRate::MinusInfinity();
+ Timestamp padding_timestamp = Timestamp::MinusInfinity();
+ };
+
+ struct HoldInfo {
+ Timestamp timestamp = Timestamp::MinusInfinity();
+ TimeDelta duration = TimeDelta::Zero();
+ DataRate rate = DataRate::PlusInfinity();
};
static absl::optional<Config> CreateConfig(
@@ -149,6 +167,8 @@ class LossBasedBweV2 {
// Returns `0.0` if not enough loss statistics have been received.
double GetAverageReportedLossRatio() const;
+ double GetAverageReportedPacketLossRatio() const;
+ double GetAverageReportedByteLossRatio() const;
std::vector<ChannelParameters> GetCandidates(bool in_alr) const;
DataRate GetCandidateBandwidthUpperBound() const;
Derivatives GetDerivatives(const ChannelParameters& channel_parameters) const;
@@ -161,50 +181,40 @@ class LossBasedBweV2 {
DataRate GetSendingRate(DataRate instantaneous_sending_rate) const;
DataRate GetInstantUpperBound() const;
void CalculateInstantUpperBound();
+ DataRate GetInstantLowerBound() const;
+ void CalculateInstantLowerBound();
void CalculateTemporalWeights();
void NewtonsMethodUpdate(ChannelParameters& channel_parameters) const;
- // Returns false if there exists a kBwOverusing or kBwUnderusing in the
- // window.
- bool TrendlineEsimateAllowBitrateIncrease() const;
-
- // Returns true if there exists an overusing state in the window.
- bool TrendlineEsimateAllowEmergencyBackoff() const;
-
// Returns false if no observation was created.
- bool PushBackObservation(rtc::ArrayView<const PacketResult> packet_results,
- BandwidthUsage delay_detector_state);
- void UpdateTrendlineEstimator(
- const std::vector<PacketResult>& packet_feedbacks,
- Timestamp at_time);
- void UpdateDelayDetector(BandwidthUsage delay_detector_state);
- bool IsEstimateIncreasingWhenLossLimited(
- const ChannelParameters& best_candidate);
- bool IsBandwidthLimitedDueToLoss() const;
- void SetProbeBitrate(absl::optional<DataRate> probe_bitrate);
- bool IsRequestingProbe() const;
+ bool PushBackObservation(rtc::ArrayView<const PacketResult> packet_results);
+ void UpdateResult();
+ bool IsEstimateIncreasingWhenLossLimited(DataRate old_estimate,
+ DataRate new_estimate);
+ bool IsInLossLimitedState() const;
+ bool CanKeepIncreasingState(DataRate estimate) const;
absl::optional<DataRate> acknowledged_bitrate_;
absl::optional<Config> config_;
- ChannelParameters current_estimate_;
+ ChannelParameters current_best_estimate_;
int num_observations_ = 0;
std::vector<Observation> observations_;
PartialObservation partial_observation_;
Timestamp last_send_time_most_recent_observation_ = Timestamp::PlusInfinity();
Timestamp last_time_estimate_reduced_ = Timestamp::MinusInfinity();
absl::optional<DataRate> cached_instant_upper_bound_;
+ absl::optional<DataRate> cached_instant_lower_bound_;
std::vector<double> instant_upper_bound_temporal_weights_;
std::vector<double> temporal_weights_;
- std::deque<BandwidthUsage> delay_detector_states_;
Timestamp recovering_after_loss_timestamp_ = Timestamp::MinusInfinity();
DataRate bandwidth_limit_in_current_window_ = DataRate::PlusInfinity();
DataRate min_bitrate_ = DataRate::KilobitsPerSec(1);
DataRate max_bitrate_ = DataRate::PlusInfinity();
- LossBasedState current_state_ = LossBasedState::kDelayBasedEstimate;
- DataRate probe_bitrate_ = DataRate::PlusInfinity();
DataRate delay_based_estimate_ = DataRate::PlusInfinity();
- Timestamp last_probe_timestamp_ = Timestamp::MinusInfinity();
+ LossBasedBweV2::Result loss_based_result_ = LossBasedBweV2::Result();
+ HoldInfo last_hold_info_ = HoldInfo();
+ PaddingInfo last_padding_info_ = PaddingInfo();
};
} // namespace webrtc