Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 19 matching lines...) Expand all Loading... | |
| 30 const int CongestionWindow::kMinimumCongestionWindowBytes; | 30 const int CongestionWindow::kMinimumCongestionWindowBytes; |
| 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(BbrBweSender::Mode mode, | 36 int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode, |
| 37 int64_t bandwidth_estimate_bps, | 37 int64_t bandwidth_estimate_bps, |
| 38 rtc::Optional<int64_t> min_rtt_ms, | 38 rtc::Optional<int64_t> min_rtt_ms, |
| 39 float gain) { | 39 float gain) { |
| 40 if (mode == BbrBweSender::PROBE_RTT) | |
| 41 return CongestionWindow::kMinimumCongestionWindowBytes; | |
|
philipel
2017/08/17 12:52:27
Why don't we have a min congestion window any more
gnish1
2017/08/17 15:37:49
This implementation of BBR doesn't use minimum con
| |
| 42 return GetTargetCongestionWindow(bandwidth_estimate_bps, min_rtt_ms, gain); | 40 return GetTargetCongestionWindow(bandwidth_estimate_bps, min_rtt_ms, gain); |
| 43 } | 41 } |
| 44 | 42 |
| 45 void CongestionWindow::PacketSent(size_t sent_packet_size_bytes) { | 43 void CongestionWindow::PacketSent(size_t sent_packet_size_bytes) { |
| 46 data_inflight_bytes_ += sent_packet_size_bytes; | 44 data_inflight_bytes_ += sent_packet_size_bytes; |
| 47 } | 45 } |
| 48 | 46 |
| 49 void CongestionWindow::AckReceived(size_t received_packet_size_bytes) { | 47 void CongestionWindow::AckReceived(size_t received_packet_size_bytes) { |
| 50 data_inflight_bytes_ -= received_packet_size_bytes; | 48 data_inflight_bytes_ -= received_packet_size_bytes; |
| 51 } | 49 } |
| 52 | 50 |
| 53 int CongestionWindow::GetTargetCongestionWindow( | 51 int CongestionWindow::GetTargetCongestionWindow( |
| 54 int64_t bandwidth_estimate_bps, | 52 int64_t bandwidth_estimate_bps, |
| 55 rtc::Optional<int64_t> min_rtt_ms, | 53 rtc::Optional<int64_t> min_rtt_ms, |
| 56 float gain) { | 54 float gain) { |
| 57 // If we have no rtt sample yet, return the starting congestion window size. | 55 // If we have no rtt sample yet, return the starting congestion window size. |
| 58 if (!min_rtt_ms) | 56 if (!min_rtt_ms) |
| 59 return gain * kStartingCongestionWindowBytes; | 57 return gain * kStartingCongestionWindowBytes; |
| 60 int bdp = *min_rtt_ms * bandwidth_estimate_bps; | 58 int bdp = *min_rtt_ms * bandwidth_estimate_bps / 8000; |
|
philipel
2017/08/17 12:52:27
Why do we suddenly measure bandwidth delay product
gnish1
2017/08/17 15:37:49
Because packet's are measured in bytes, so data_in
| |
| 61 int congestion_window = bdp * gain; | 59 int congestion_window = bdp * gain; |
| 62 // Congestion window could be zero in rare cases, when either no bandwidth | 60 // Congestion window could be zero in rare cases, when either no bandwidth |
| 63 // estimate is available, or path's min_rtt value is zero. | 61 // estimate is available, or path's min_rtt value is zero. |
| 64 if (!congestion_window) | 62 if (!congestion_window) |
| 65 congestion_window = gain * kStartingCongestionWindowBytes; | 63 congestion_window = gain * kStartingCongestionWindowBytes; |
| 66 return std::max(congestion_window, | 64 return congestion_window; |
| 67 CongestionWindow::kMinimumCongestionWindowBytes); | |
| 68 } | 65 } |
| 69 } // namespace bwe | 66 } // namespace bwe |
| 70 } // namespace testing | 67 } // namespace testing |
| 71 } // namespace webrtc | 68 } // namespace webrtc |
| OLD | NEW |