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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 int64_t start_bitrate_bps, | 64 int64_t start_bitrate_bps, |
65 int64_t max_bitrate_bps) { | 65 int64_t max_bitrate_bps) { |
66 rtc::CritScope cs(&critsect_); | 66 rtc::CritScope cs(&critsect_); |
67 | 67 |
68 if (start_bitrate_bps > 0) { | 68 if (start_bitrate_bps > 0) { |
69 start_bitrate_bps_ = start_bitrate_bps; | 69 start_bitrate_bps_ = start_bitrate_bps; |
70 } else if (start_bitrate_bps_ == 0) { | 70 } else if (start_bitrate_bps_ == 0) { |
71 start_bitrate_bps_ = min_bitrate_bps; | 71 start_bitrate_bps_ = min_bitrate_bps; |
72 } | 72 } |
73 | 73 |
74 // The reason we set use the variable |old_max_bitrate_pbs| is because we | |
stefan-webrtc
2017/01/16 13:23:59
-set
philipel
2017/01/16 13:59:28
Done.
| |
75 // need to set |max_bitrate_bps_| before we call InitiateProbing. | |
74 int64_t old_max_bitrate_bps = max_bitrate_bps_; | 76 int64_t old_max_bitrate_bps = max_bitrate_bps_; |
75 max_bitrate_bps_ = max_bitrate_bps; | 77 max_bitrate_bps_ = max_bitrate_bps; |
76 | 78 |
77 switch (state_) { | 79 switch (state_) { |
78 case State::kInit: | 80 case State::kInit: |
79 if (network_state_ == kNetworkUp) | 81 if (network_state_ == kNetworkUp) |
80 InitiateExponentialProbing(); | 82 InitiateExponentialProbing(); |
81 break; | 83 break; |
82 | 84 |
83 case State::kWaitingForProbingResult: | 85 case State::kWaitingForProbingResult: |
84 break; | 86 break; |
85 | 87 |
86 case State::kProbingComplete: | 88 case State::kProbingComplete: |
87 // Initiate probing when |max_bitrate_| was increased mid-call. | 89 // If the new max bitrate is higher than the old max bitrate and the |
88 if (estimated_bitrate_bps_ != kExponentialProbingDisabled && | 90 // estimate is lower than the new max bitrate then initiate probing. |
89 estimated_bitrate_bps_ < old_max_bitrate_bps && | 91 if (estimated_bitrate_bps_ != 0 && |
stefan-webrtc
2017/01/16 13:23:59
Should probably still compare with kExponentialPro
philipel
2017/01/16 13:59:28
This logic is not related to exponential probing,
| |
90 max_bitrate_bps_ > old_max_bitrate_bps) { | 92 old_max_bitrate_bps < max_bitrate_bps_ && |
93 estimated_bitrate_bps_ < max_bitrate_bps_) { | |
91 InitiateProbing(clock_->TimeInMilliseconds(), {max_bitrate_bps}, false); | 94 InitiateProbing(clock_->TimeInMilliseconds(), {max_bitrate_bps}, false); |
92 } | 95 } |
93 break; | 96 break; |
94 } | 97 } |
95 } | 98 } |
96 | 99 |
97 void ProbeController::OnNetworkStateChanged(NetworkState network_state) { | 100 void ProbeController::OnNetworkStateChanged(NetworkState network_state) { |
98 rtc::CritScope cs(&critsect_); | 101 rtc::CritScope cs(&critsect_); |
99 network_state_ = network_state; | 102 network_state_ = network_state; |
100 if (network_state_ == kNetworkUp && state_ == State::kInit) | 103 if (network_state_ == kNetworkUp && state_ == State::kInit) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 state_ = State::kWaitingForProbingResult; | 211 state_ = State::kWaitingForProbingResult; |
209 min_bitrate_to_probe_further_bps_ = | 212 min_bitrate_to_probe_further_bps_ = |
210 (*(bitrates_to_probe.end() - 1)) * kRepeatedProbeMinPercentage / 100; | 213 (*(bitrates_to_probe.end() - 1)) * kRepeatedProbeMinPercentage / 100; |
211 } else { | 214 } else { |
212 state_ = State::kProbingComplete; | 215 state_ = State::kProbingComplete; |
213 min_bitrate_to_probe_further_bps_ = kExponentialProbingDisabled; | 216 min_bitrate_to_probe_further_bps_ = kExponentialProbingDisabled; |
214 } | 217 } |
215 } | 218 } |
216 | 219 |
217 } // namespace webrtc | 220 } // namespace webrtc |
OLD | NEW |