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

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: Minor changes 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
(Empty)
1 /*
2 * Copyright (c) 2017 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
12 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_win dow.h"
13
14 #include <algorithm>
15
16 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/bbr.h"
17
18 namespace webrtc {
19 namespace testing {
20 namespace bwe {
21 namespace {
22 // kStartingCongestionWindow is used to set congestion window when bandwidth
23 // delay product is equal to zero, so that we don't set window to zero as well.
24 // Chosen randomly by me, because this value shouldn't make any significant
25 // difference, as bandwidth delay product is more than zero almost every time.
26 const int kStartingCongestionWindow = 6000;
terelius 2017/07/12 10:34:50 Is there any reason for not setting it to the mini
gnish1 2017/07/12 12:23:18 It depends on the situation, this variable shouldn
27 // Size of congestion window while in PROBE_RTT mode, suggested by BBR's source
28 // code of QUIC's implementation.
29 const int kMinimumCongestionWindow = 5840;
30 } // namespace
31
32 CongestionWindow::CongestionWindow() : data_inflight_(0) {}
33
34 CongestionWindow::~CongestionWindow() {}
35
36 int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode,
37 int64_t bandwidth_estimate,
38 int64_t min_rtt,
39 float gain,
40 size_t bytes_acked,
41 int multiplier) {
42 if (mode == BbrBweSender::PROBE_RTT)
43 return kMinimumCongestionWindow;
44 return GetTargetCongestionWindow(bandwidth_estimate, min_rtt, gain) +
45 multiplier * bytes_acked;
terelius 2017/07/12 10:34:51 Why do we add bytes_acked?
gnish1 2017/07/12 12:23:18 Done.
46 }
47
48 void CongestionWindow::PacketSent(size_t sent_packet_size) {
49 data_inflight_ += sent_packet_size;
50 }
51
52 void CongestionWindow::AckReceived(size_t received_packet_size) {
53 data_inflight_ -= received_packet_size;
54 }
55
56 int CongestionWindow::GetTargetCongestionWindow(int64_t bandwidth_estimate,
57 int64_t min_rtt,
58 float gain) {
59 int bdp = min_rtt * bandwidth_estimate;
60 int congestion_window = bdp * gain;
61 // Congestion window could be zero in rare cases, when either no bandwidth
62 // estimate is available, or path's min_rtt value is zero.
63 if (!congestion_window)
64 congestion_window = gain * kStartingCongestionWindow;
terelius 2017/07/12 10:34:50 Shouldn't the gain factor already be part of kStar
gnish1 2017/07/12 12:23:18 No, gain factor may change, so it is not possible
65 return std::max(congestion_window, kMinimumCongestionWindow);
66 }
67 } // namespace bwe
68 } // namespace testing
69 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698