Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(803)

Unified Diff: webrtc/modules/congestion_controller/probe_controller.cc

Issue 2504783002: Revert of Start probes only after network is connected. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/congestion_controller/probe_controller.cc
diff --git a/webrtc/modules/congestion_controller/probe_controller.cc b/webrtc/modules/congestion_controller/probe_controller.cc
index 272c1eb4e598c82b859beab9548e5258b8dcea4e..7e1d936a1eb7d2be61d108cd4c82bee777325338 100644
--- a/webrtc/modules/congestion_controller/probe_controller.cc
+++ b/webrtc/modules/congestion_controller/probe_controller.cc
@@ -46,12 +46,10 @@
ProbeController::ProbeController(PacedSender* pacer, Clock* clock)
: pacer_(pacer),
clock_(clock),
- network_state_(kNetworkUp),
state_(State::kInit),
min_bitrate_to_probe_further_bps_(kExponentialProbingDisabled),
time_last_probing_initiated_ms_(0),
estimated_bitrate_bps_(0),
- start_bitrate_bps_(0),
max_bitrate_bps_(0),
last_alr_probing_time_(clock_->TimeInMilliseconds()) {}
@@ -59,49 +57,28 @@
int start_bitrate_bps,
int max_bitrate_bps) {
rtc::CritScope cs(&critsect_);
-
- start_bitrate_bps_ =
- start_bitrate_bps > 0 ? start_bitrate_bps : min_bitrate_bps;
+ if (state_ == State::kInit) {
+ // When probing at 1.8 Mbps ( 6x 300), this represents a threshold of
+ // 1.2 Mbps to continue probing.
+ InitiateProbing({3 * start_bitrate_bps, 6 * start_bitrate_bps},
+ 4 * start_bitrate_bps);
+ }
int old_max_bitrate_bps = max_bitrate_bps_;
max_bitrate_bps_ = max_bitrate_bps;
- switch (state_) {
- case State::kInit:
- if (network_state_ == kNetworkUp)
- InitiateExponentialProbing();
- break;
-
- case State::kWaitingForProbingResult:
- break;
-
- case State::kProbingComplete:
- // Initiate probing when |max_bitrate_| was increased mid-call.
- if (estimated_bitrate_bps_ != 0 &&
- estimated_bitrate_bps_ < old_max_bitrate_bps &&
- max_bitrate_bps_ > old_max_bitrate_bps) {
- InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled);
- }
- break;
+ // Only do probing if:
+ // we are mid-call, which we consider to be if
+ // exponential probing is not active and
+ // |estimated_bitrate_bps_| is valid (> 0) and
+ // the current bitrate is lower than the new |max_bitrate_bps|, and
+ // |max_bitrate_bps_| was increased.
+ if (state_ != State::kWaitingForProbingResult &&
+ estimated_bitrate_bps_ != 0 &&
+ estimated_bitrate_bps_ < old_max_bitrate_bps &&
+ max_bitrate_bps_ > old_max_bitrate_bps) {
+ InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled);
}
-}
-
-void ProbeController::OnNetworkStateChanged(NetworkState network_state) {
- rtc::CritScope cs(&critsect_);
- network_state_ = network_state;
- if (network_state_ == kNetworkUp && state_ == State::kInit)
- InitiateExponentialProbing();
-}
-
-void ProbeController::InitiateExponentialProbing() {
- RTC_DCHECK(network_state_ == kNetworkUp);
- RTC_DCHECK(state_ == State::kInit);
- RTC_DCHECK_GT(start_bitrate_bps_, 0);
-
- // When probing at 1.8 Mbps ( 6x 300), this represents a threshold of
- // 1.2 Mbps to continue probing.
- InitiateProbing({3 * start_bitrate_bps_, 6 * start_bitrate_bps_},
- 4 * start_bitrate_bps_);
}
void ProbeController::SetEstimatedBitrate(int bitrate_bps) {

Powered by Google App Engine
This is Rietveld 408576698