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

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

Issue 2924603002: Added implementation of four functions in the BBR congestion controller. (Closed)
Patch Set: Created 3 years, 6 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 */
11 11
12 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/bbr.h" 12 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/bbr.h"
13 13
14 #include <time.h> 14 #include <time.h>
15 #include <algorithm> 15 #include <algorithm>
16 #include <utility> 16 #include <utility>
17 17
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" 19 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
20 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" 20 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
21 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_ filter.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 namespace testing { 24 namespace testing {
24 namespace bwe { 25 namespace bwe {
25 BbrBweSender::BbrBweSender() : BweSender() { 26 namespace {
27 const int kFeedbackIntervalsMs = 100;
28 const float kHighGain = 2.885;
philipel 2017/06/05 15:04:51 Comment where you got these values from.
gnish1 2017/06/07 07:52:00 Done.
29 const float kDrainGain = 1 / kHighGain;
30 const float kStartupGrowthTarget = 1.25;
31 const int kMaxRoundsWithoutGrowth = 3;
32 } //
33 BbrBweSender::BbrBweSender(Clock* clock)
34 : BweSender(0),
35 clock_(clock),
36 mode_(STARTUP),
37 max_bandwidth_filter_(),
38 rt_count_(0),
39 last_packet_sent_(0),
40 round_trip_end_(0),
41 full_bandwidth_reached_(false) {
26 // Initially enter Startup mode. 42 // Initially enter Startup mode.
27 EnterStartup(); 43 EnterStartup();
28 } 44 }
29 45
30 BbrBweSender::~BbrBweSender() {} 46 BbrBweSender::~BbrBweSender() {}
31 47
32 int BbrBweSender::GetFeedbackIntervalMs() const { 48 int BbrBweSender::GetFeedbackIntervalMs() const {
33 return 0; 49 return kFeedbackIntervalsMs;
34 } 50 }
35 51
36 void BbrBweSender::GiveFeedback(const FeedbackPacket& feedback) {} 52 void BbrBweSender::GiveFeedback(const FeedbackPacket& feedback) {
53 const BbrBweFeedback& fb = static_cast<const BbrBweFeedback&>(feedback);
54 const std::vector<std::pair<uint64_t, int64_t>>& feedback_vector =
55 fb.packet_feedback_vector();
56 // Check if new round started for the connection.
philipel 2017/06/05 15:04:51 Don't split comments into unnecessarily many lines
gnish1 2017/06/07 07:52:00 Done.
57 // Round is the period of time from sending packet
58 // to its acknowledgement.
59 bool new_round_started = false;
60 if (!feedback_vector.empty()) {
61 uint64_t last_acked_packet = feedback_vector.rbegin()->first;
62 if (last_acked_packet > round_trip_end_) {
63 new_round_started = true;
64 rt_count_++;
65 round_trip_end_ = last_packet_sent_;
66 }
67 }
68 if (new_round_started && !full_bandwidth_reached_)
philipel 2017/06/05 15:04:50 When the if statement or the following expression
gnish1 2017/06/07 07:52:00 Done.
69 full_bandwidth_reached_ = max_bandwidth_filter_->FullBandwidthReached(
70 kStartupGrowthTarget, kMaxRoundsWithoutGrowth);
71 int now = clock_->TimeInMilliseconds();
72 switch (mode_) {
73 break;
74 case STARTUP:
75 TryExitingStartup();
76 break;
77 case DRAIN:
78 TryExitingDrain(now);
79 break;
80 case PROBE_BW:
81 TryUpdatingCyclePhase(now);
82 break;
83 case PROBE_RTT:
84 break;
85 }
86 TryEnteringOrExitingProbeRtt(now);
philipel 2017/06/05 15:04:51 Should this function always be called?
gnish1 2017/06/07 07:52:00 Yes,if min_rtt value expired it will start ProbeRt
terelius 2017/06/07 08:14:55 Is this equivalent to: ... case PROBE_RTT:
87 // TODO(gnish): implement functions updating
88 // congestion window and pacing rate controllers.
89 }
37 90
38 bool BbrBweSender::UpdateBandwidthAndMinRtt() { 91 bool BbrBweSender::UpdateBandwidthAndMinRtt() {
39 return false; 92 return false;
40 } 93 }
41 94
42 void BbrBweSender::EnterStartup() {} 95 void BbrBweSender::EnterStartup() {
96 mode_ = STARTUP;
97 pacing_gain_ = kHighGain;
98 congestion_window_gain_ = kHighGain;
99 }
43 100
44 void BbrBweSender::TryExitingStartup() {} 101 void BbrBweSender::TryExitingStartup() {
102 if (full_bandwidth_reached_) {
103 mode_ = DRAIN;
104 pacing_gain_ = kDrainGain;
105 congestion_window_gain_ = kHighGain;
106 }
107 }
45 108
46 void BbrBweSender::TryExitingDrain(int64_t now) {} 109 void BbrBweSender::TryExitingDrain(int64_t now) {}
47 110
48 void BbrBweSender::EnterProbeBw(int64_t now) {} 111 void BbrBweSender::EnterProbeBw(int64_t now) {}
49 112
50 void BbrBweSender::TryUpdatingCyclePhase(int64_t now) {} 113 void BbrBweSender::TryUpdatingCyclePhase(int64_t now) {}
51 114
52 void BbrBweSender::EnterProbeRtt(int64_t now) {} 115 void BbrBweSender::TryEnteringOrExitingProbeRtt(int64_t now) {}
53
54 void BbrBweSender::TryExitingProbeRtt(int64_t now) {}
55 116
56 int64_t BbrBweSender::TimeUntilNextProcess() { 117 int64_t BbrBweSender::TimeUntilNextProcess() {
57 return 100; 118 return 100;
58 } 119 }
59 120
60 void BbrBweSender::OnPacketsSent(const Packets& packets) {} 121 void BbrBweSender::OnPacketsSent(const Packets& packets) {
122 last_packet_sent_ =
123 (static_cast<const MediaPacket*>(packets.back()))->sequence_number();
philipel 2017/06/05 15:04:51 remove one set of ()
gnish1 2017/06/07 07:52:00 Done.
124 }
61 125
62 void BbrBweSender::Process() {} 126 void BbrBweSender::Process() {}
63 127
64 BbrBweReceiver::BbrBweReceiver(int flow_id) 128 BbrBweReceiver::BbrBweReceiver(int flow_id)
65 : BweReceiver(flow_id, kReceivingRateTimeWindowMs), 129 : BweReceiver(flow_id, kReceivingRateTimeWindowMs),
66 clock_(0), 130 clock_(0),
67 packet_feedbacks_() {} 131 packet_feedbacks_() {}
68 132
69 BbrBweReceiver::~BbrBweReceiver() {} 133 BbrBweReceiver::~BbrBweReceiver() {}
70 134
71 void BbrBweReceiver::ReceivePacket(int64_t arrival_time_ms, 135 void BbrBweReceiver::ReceivePacket(int64_t arrival_time_ms,
72 const MediaPacket& media_packet) {} 136 const MediaPacket& media_packet) {}
73 137
74 FeedbackPacket* BbrBweReceiver::GetFeedback(int64_t now_ms) { 138 FeedbackPacket* BbrBweReceiver::GetFeedback(int64_t now_ms) {
75 return nullptr; 139 return nullptr;
76 } 140 }
77 } // namespace bwe 141 } // namespace bwe
78 } // namespace testing 142 } // namespace testing
79 } // namespace webrtc 143 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698