 Chromium Code Reviews
 Chromium Code Reviews Issue 2609113003:
  BitrateProber::CreateProbeCluster now only accept one parameter (bitrate_bps).  (Closed)
    
  
    Issue 2609113003:
  BitrateProber::CreateProbeCluster now only accept one parameter (bitrate_bps).  (Closed) 
  | 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 | 
| 11 #include "webrtc/modules/congestion_controller/probe_controller.h" | 11 #include "webrtc/modules/congestion_controller/probe_controller.h" | 
| 12 | 12 | 
| 13 #include <algorithm> | 13 #include <algorithm> | 
| 14 #include <initializer_list> | 14 #include <initializer_list> | 
| 15 | 15 | 
| 16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" | 
| 17 #include "webrtc/base/safe_conversions.h" | 17 #include "webrtc/base/safe_conversions.h" | 
| 18 #include "webrtc/system_wrappers/include/metrics.h" | 18 #include "webrtc/system_wrappers/include/metrics.h" | 
| 19 | 19 | 
| 20 namespace webrtc { | 20 namespace webrtc { | 
| 21 | 21 | 
| 22 namespace { | 22 namespace { | 
| 23 | |
| 24 // Number of deltas between probes per cluster. On the very first cluster, | |
| 25 // we will need kProbeDeltasPerCluster + 1 probes, but on a cluster following | |
| 26 // another, we need kProbeDeltasPerCluster probes. | |
| 27 constexpr int kProbeDeltasPerCluster = 5; | |
| 28 | |
| 29 // Maximum waiting time from the time of initiating probing to getting | 23 // Maximum waiting time from the time of initiating probing to getting | 
| 30 // the measured results back. | 24 // the measured results back. | 
| 31 constexpr int64_t kMaxWaitingTimeForProbingResultMs = 1000; | 25 constexpr int64_t kMaxWaitingTimeForProbingResultMs = 1000; | 
| 32 | 26 | 
| 33 // Value of |min_bitrate_to_probe_further_bps_| that indicates | 27 // Value of |min_bitrate_to_probe_further_bps_| that indicates | 
| 34 // further probing is disabled. | 28 // further probing is disabled. | 
| 35 constexpr int kExponentialProbingDisabled = 0; | 29 constexpr int kExponentialProbingDisabled = 0; | 
| 36 | 30 | 
| 37 // Default probing bitrate limit. Applied only when the application didn't | 31 // Default probing bitrate limit. Applied only when the application didn't | 
| 38 // specify max bitrate. | 32 // specify max bitrate. | 
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 std::initializer_list<int64_t> bitrates_to_probe, | 195 std::initializer_list<int64_t> bitrates_to_probe, | 
| 202 bool probe_further) { | 196 bool probe_further) { | 
| 203 bool first_cluster = true; | 197 bool first_cluster = true; | 
| 204 for (int64_t bitrate : bitrates_to_probe) { | 198 for (int64_t bitrate : bitrates_to_probe) { | 
| 205 int64_t max_probe_bitrate_bps = | 199 int64_t max_probe_bitrate_bps = | 
| 206 max_bitrate_bps_ > 0 ? max_bitrate_bps_ : kDefaultMaxProbingBitrateBps; | 200 max_bitrate_bps_ > 0 ? max_bitrate_bps_ : kDefaultMaxProbingBitrateBps; | 
| 207 if (bitrate > max_probe_bitrate_bps) { | 201 if (bitrate > max_probe_bitrate_bps) { | 
| 208 bitrate = max_probe_bitrate_bps; | 202 bitrate = max_probe_bitrate_bps; | 
| 209 probe_further = false; | 203 probe_further = false; | 
| 210 } | 204 } | 
| 211 if (first_cluster) { | 205 if (first_cluster) { | 
| 
terelius
2017/01/04 13:03:04
Is this used? If not, please remove first_cluster.
 
philipel
2017/01/04 13:31:14
Not used, removed.
 | |
| 212 pacer_->CreateProbeCluster(rtc::checked_cast<int>(bitrate), | 206 pacer_->CreateProbeCluster(rtc::checked_cast<int>(bitrate)); | 
| 213 kProbeDeltasPerCluster + 1); | |
| 214 first_cluster = false; | 207 first_cluster = false; | 
| 215 } else { | 208 } else { | 
| 216 pacer_->CreateProbeCluster(rtc::checked_cast<int>(bitrate), | 209 pacer_->CreateProbeCluster(rtc::checked_cast<int>(bitrate)); | 
| 217 kProbeDeltasPerCluster); | |
| 218 } | 210 } | 
| 219 } | 211 } | 
| 220 time_last_probing_initiated_ms_ = now_ms; | 212 time_last_probing_initiated_ms_ = now_ms; | 
| 221 if (probe_further) { | 213 if (probe_further) { | 
| 222 state_ = State::kWaitingForProbingResult; | 214 state_ = State::kWaitingForProbingResult; | 
| 223 min_bitrate_to_probe_further_bps_ = | 215 min_bitrate_to_probe_further_bps_ = | 
| 224 (*(bitrates_to_probe.end() - 1)) * kRepeatedProbeMinPercentage / 100; | 216 (*(bitrates_to_probe.end() - 1)) * kRepeatedProbeMinPercentage / 100; | 
| 225 } else { | 217 } else { | 
| 226 state_ = State::kProbingComplete; | 218 state_ = State::kProbingComplete; | 
| 227 min_bitrate_to_probe_further_bps_ = kExponentialProbingDisabled; | 219 min_bitrate_to_probe_further_bps_ = kExponentialProbingDisabled; | 
| 228 } | 220 } | 
| 229 } | 221 } | 
| 230 | 222 | 
| 231 } // namespace webrtc | 223 } // namespace webrtc | 
| OLD | NEW |