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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc

Issue 2966403002: Added implementation of three classes in BBR,with unit-tests. (Closed)
Patch Set: Added logic for entering/exiting modes in BBR, added new bandwidth filter. Created 3 years, 5 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 15 matching lines...) Expand all
26 const int kStartingCongestionWindow = 6000; 26 const int kStartingCongestionWindow = 6000;
27 // Size of congestion window while in PROBE_RTT mode, suggested by BBR's source 27 // Size of congestion window while in PROBE_RTT mode, suggested by BBR's source
28 // code of QUIC's implementation. 28 // code of QUIC's implementation.
29 const int kMinimumCongestionWindow = 5840; 29 const int kMinimumCongestionWindow = 5840;
30 } // namespace 30 } // namespace
31 31
32 CongestionWindow::CongestionWindow() : data_inflight_bytes_(0) {} 32 CongestionWindow::CongestionWindow() : data_inflight_bytes_(0) {}
33 33
34 CongestionWindow::~CongestionWindow() {} 34 CongestionWindow::~CongestionWindow() {}
35 35
36 int CongestionWindow::GetCongestionWindow( 36 int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode,
37 BbrBweSender::Mode mode, 37 int64_t bandwidth_estimate_bps,
38 int64_t bandwidth_estimate_bytes_per_ms, 38 rtc::Optional<int64_t> min_rtt_ms,
39 int64_t min_rtt_ms, 39 float gain) {
40 float gain) {
41 if (mode == BbrBweSender::PROBE_RTT) 40 if (mode == BbrBweSender::PROBE_RTT)
42 return kMinimumCongestionWindow; 41 return kMinimumCongestionWindow;
43 return GetTargetCongestionWindow(bandwidth_estimate_bytes_per_ms, min_rtt_ms, 42 return GetTargetCongestionWindow(bandwidth_estimate_bps, min_rtt_ms, gain);
44 gain);
45 } 43 }
46 44
47 void CongestionWindow::PacketSent(size_t sent_packet_size_bytes) { 45 void CongestionWindow::PacketSent(size_t sent_packet_size_bytes) {
48 data_inflight_bytes_ += sent_packet_size_bytes; 46 data_inflight_bytes_ += sent_packet_size_bytes;
49 } 47 }
50 48
51 void CongestionWindow::AckReceived(size_t received_packet_size_bytes) { 49 void CongestionWindow::AckReceived(size_t received_packet_size_bytes) {
52 data_inflight_bytes_ -= received_packet_size_bytes; 50 data_inflight_bytes_ -= received_packet_size_bytes;
53 } 51 }
54 52
55 int CongestionWindow::GetTargetCongestionWindow( 53 int CongestionWindow::GetTargetCongestionWindow(
56 int64_t bandwidth_estimate_bytes_per_ms, 54 int64_t bandwidth_estimate_bps,
57 int64_t min_rtt_ms, 55 rtc::Optional<int64_t> min_rtt_ms,
58 float gain) { 56 float gain) {
59 int bdp = min_rtt_ms * bandwidth_estimate_bytes_per_ms; 57 int bdp = *min_rtt_ms * bandwidth_estimate_bps;
60 int congestion_window = bdp * gain; 58 int congestion_window = bdp * gain;
61 // Congestion window could be zero in rare cases, when either no bandwidth 59 // Congestion window could be zero in rare cases, when either no bandwidth
62 // estimate is available, or path's min_rtt value is zero. 60 // estimate is available, or path's min_rtt value is zero.
63 if (!congestion_window) 61 if (!congestion_window)
64 congestion_window = gain * kStartingCongestionWindow; 62 congestion_window = gain * kStartingCongestionWindow;
65 return std::max(congestion_window, kMinimumCongestionWindow); 63 return std::max(congestion_window, kMinimumCongestionWindow);
66 } 64 }
67 } // namespace bwe 65 } // namespace bwe
68 } // namespace testing 66 } // namespace testing
69 } // namespace webrtc 67 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698