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

Side by Side Diff: webrtc/modules/congestion_controller/probe_controller.cc

Issue 2269873002: Avoid cluster set up at max bitrate at start (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup
Patch Set: Fix test Created 4 years, 3 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 int max_bitrate_bps) { 47 int max_bitrate_bps) {
48 rtc::CritScope cs(&critsect_); 48 rtc::CritScope cs(&critsect_);
49 if (state_ == State::kInit) { 49 if (state_ == State::kInit) {
50 // When probing at 1.8 Mbps ( 6x 300), this represents a threshold of 50 // When probing at 1.8 Mbps ( 6x 300), this represents a threshold of
51 // 1.2 Mbps to continue probing. 51 // 1.2 Mbps to continue probing.
52 InitiateProbing({3 * start_bitrate_bps, 6 * start_bitrate_bps}, 52 InitiateProbing({3 * start_bitrate_bps, 6 * start_bitrate_bps},
53 4 * start_bitrate_bps); 53 4 * start_bitrate_bps);
54 } 54 }
55 55
56 // Only do probing if: 56 // Only do probing if:
57 // - we are mid-call, which we consider to be if 57 // we are mid-call, which we consider to be if
58 // |estimated_bitrate_bps_| != 0, and 58 // exponential probing is not active and
59 // - the current bitrate is lower than the new |max_bitrate_bps|, and 59 // |estimated_bitrate_bps_| is valid (> 0) and
60 // - we actually want to increase the |max_bitrate_bps_|. 60 // the current bitrate is lower than the new |max_bitrate_bps|, and
61 if (estimated_bitrate_bps_ != 0 && estimated_bitrate_bps_ < max_bitrate_bps && 61 // we actually want to increase the |max_bitrate_bps_|.
62 if (state_ != State::kWaitingForProbingResult &&
63 estimated_bitrate_bps_ != 0 &&
64 estimated_bitrate_bps_ < max_bitrate_bps &&
62 max_bitrate_bps > max_bitrate_bps_) { 65 max_bitrate_bps > max_bitrate_bps_) {
63 InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled); 66 InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled);
64 } 67 }
65 max_bitrate_bps_ = max_bitrate_bps; 68 max_bitrate_bps_ = max_bitrate_bps;
66 } 69 }
67 70
68 void ProbeController::SetEstimatedBitrate(int bitrate_bps) { 71 void ProbeController::SetEstimatedBitrate(int bitrate_bps) {
69 rtc::CritScope cs(&critsect_); 72 rtc::CritScope cs(&critsect_);
70 if (state_ == State::kWaitingForProbingResult) { 73 if (state_ == State::kWaitingForProbingResult) {
71 if ((clock_->TimeInMilliseconds() - time_last_probing_initiated_ms_) > 74 if ((clock_->TimeInMilliseconds() - time_last_probing_initiated_ms_) >
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 107 }
105 min_bitrate_to_probe_further_bps_ = min_bitrate_to_probe_further_bps; 108 min_bitrate_to_probe_further_bps_ = min_bitrate_to_probe_further_bps;
106 time_last_probing_initiated_ms_ = clock_->TimeInMilliseconds(); 109 time_last_probing_initiated_ms_ = clock_->TimeInMilliseconds();
107 if (min_bitrate_to_probe_further_bps == kExponentialProbingDisabled) 110 if (min_bitrate_to_probe_further_bps == kExponentialProbingDisabled)
108 state_ = State::kProbingComplete; 111 state_ = State::kProbingComplete;
109 else 112 else
110 state_ = State::kWaitingForProbingResult; 113 state_ = State::kWaitingForProbingResult;
111 } 114 }
112 115
113 } // namespace webrtc 116 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698