OLD | NEW |
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 Loading... |
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 && estimated_bitrate_bps_ < max_bitrate_bps && |
62 max_bitrate_bps > max_bitrate_bps_) { | 64 max_bitrate_bps > max_bitrate_bps_) { |
63 InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled); | 65 InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled); |
64 } | 66 } |
65 max_bitrate_bps_ = max_bitrate_bps; | 67 max_bitrate_bps_ = max_bitrate_bps; |
66 } | 68 } |
67 | 69 |
68 void ProbeController::SetEstimatedBitrate(int bitrate_bps) { | 70 void ProbeController::SetEstimatedBitrate(int bitrate_bps) { |
69 rtc::CritScope cs(&critsect_); | 71 rtc::CritScope cs(&critsect_); |
70 if (state_ == State::kWaitingForProbingResult) { | 72 if (state_ == State::kWaitingForProbingResult) { |
71 if ((clock_->TimeInMilliseconds() - time_last_probing_initiated_ms_) > | 73 if ((clock_->TimeInMilliseconds() - time_last_probing_initiated_ms_) > |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 106 } |
105 min_bitrate_to_probe_further_bps_ = min_bitrate_to_probe_further_bps; | 107 min_bitrate_to_probe_further_bps_ = min_bitrate_to_probe_further_bps; |
106 time_last_probing_initiated_ms_ = clock_->TimeInMilliseconds(); | 108 time_last_probing_initiated_ms_ = clock_->TimeInMilliseconds(); |
107 if (min_bitrate_to_probe_further_bps == kExponentialProbingDisabled) | 109 if (min_bitrate_to_probe_further_bps == kExponentialProbingDisabled) |
108 state_ = State::kProbingComplete; | 110 state_ = State::kProbingComplete; |
109 else | 111 else |
110 state_ = State::kWaitingForProbingResult; | 112 state_ = State::kWaitingForProbingResult; |
111 } | 113 } |
112 | 114 |
113 } // namespace webrtc | 115 } // namespace webrtc |
OLD | NEW |