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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.cc

Issue 2380883003: Add interval estimator to remote bitrate estimator (Closed)
Patch Set: Response to an offline discussion. 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.h"
12
13 #include <algorithm>
14 #include <utility>
15
16 namespace webrtc {
17
18 namespace {
19 constexpr int kMinIntervalMs = 2000;
20 constexpr int kMaxIntervalMs = 50000;
21 }
22
23 ProbingIntervalEstimator::ProbingIntervalEstimator(
24 const AimdRateControl* const aimd_rate_control)
25 : ProbingIntervalEstimator(kMinIntervalMs,
26 kMaxIntervalMs,
27 aimd_rate_control) {}
28
29 ProbingIntervalEstimator::ProbingIntervalEstimator(
30 int min_interval_ms,
31 int max_interval_ms,
32 const AimdRateControl* const aimd_rate_control)
33 : min_interval_ms_(min_interval_ms),
34 max_interval_ms_(max_interval_ms),
35 aimd_rate_control_(aimd_rate_control) {}
36
37 rtc::Optional<int> ProbingIntervalEstimator::GetIntervalMs() const {
38 auto drop_hight = aimd_rate_control_->GetLastDecrease();
stefan-webrtc 2016/11/08 13:06:28 rtc::Optional<int> drop_height
michaelt 2016/11/09 07:54:45 Done.
39 auto increase_rate = aimd_rate_control_->GetNearMaxIncreaseRateBps();
40 if (drop_hight && increase_rate > 0) {
41 return rtc::Optional<int>(std::min(
42 max_interval_ms_,
43 std::max(1000 * (*drop_hight) / increase_rate, min_interval_ms_)));
44 }
45 return rtc::Optional<int>();
46 }
47
48 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698