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

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

Issue 2966403002: Added implementation of three classes in BBR,with unit-tests. (Closed)
Patch Set: Variables' names changed, added units in which they are measured. 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 */
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 "webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_ filter.h" 14 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_ filter.h"
15 15
16 namespace webrtc { 16 namespace webrtc {
17 namespace testing { 17 namespace testing {
18 namespace bwe { 18 namespace bwe {
19 namespace { 19 namespace {
20 const int kFeedbackIntervalsMs = 100; 20 const int kFeedbackIntervalsMs = 100;
21 // BBR uses this value to double sending rate each round trip. Design document 21 // BBR uses this value to double sending rate each round trip. Design document
22 // suggests using this value. 22 // suggests using this value.
23 const float kHighGain = 2.885f; 23 const float kHighGain = 2.885f;
24 // BBR uses this value to drain queues created during STARTUP in one round trip 24 // BBR uses this value to drain queues created during STARTUP in one round trip
25 // time. 25 // time.
26 const float kDrainGain = 1 / kHighGain; 26 const float kDrainGain = 1 / kHighGain;
27 // kStartupGrowthTarget and kMaxRoundsWithoutGrowth are chosen from 27 // kStartupGrowthTarget and kMaxRoundsWithoutGrowth are chosen from
28 // experiments,according to design document. 28 // experiments, according to the design document.
29 const float kStartupGrowthTarget = 1.25f; 29 const float kStartupGrowthTarget = 1.25f;
30 const int kMaxRoundsWithoutGrowth = 3; 30 const int kMaxRoundsWithoutGrowth = 3;
31 } // namespace 31 } // namespace
32 32
33 BbrBweSender::BbrBweSender(Clock* clock) 33 BbrBweSender::BbrBweSender(Clock* clock)
34 : BweSender(0), 34 : BweSender(0),
35 clock_(clock), 35 clock_(clock),
36 mode_(STARTUP), 36 mode_(STARTUP),
37 max_bandwidth_filter_(new MaxBandwidthFilter()), 37 max_bandwidth_filter_(new MaxBandwidthFilter()),
38 round_count_(0), 38 round_count_(0),
(...skipping 22 matching lines...) Expand all
61 if (last_acked_packet > round_trip_end_) { 61 if (last_acked_packet > round_trip_end_) {
62 new_round_started = true; 62 new_round_started = true;
63 round_count_++; 63 round_count_++;
64 round_trip_end_ = last_packet_sent_; 64 round_trip_end_ = last_packet_sent_;
65 } 65 }
66 } 66 }
67 if (new_round_started && !full_bandwidth_reached_) { 67 if (new_round_started && !full_bandwidth_reached_) {
68 full_bandwidth_reached_ = max_bandwidth_filter_->FullBandwidthReached( 68 full_bandwidth_reached_ = max_bandwidth_filter_->FullBandwidthReached(
69 kStartupGrowthTarget, kMaxRoundsWithoutGrowth); 69 kStartupGrowthTarget, kMaxRoundsWithoutGrowth);
70 } 70 }
71 int now = clock_->TimeInMilliseconds(); 71 int now_ms = clock_->TimeInMilliseconds();
72 switch (mode_) { 72 switch (mode_) {
73 break; 73 break;
74 case STARTUP: 74 case STARTUP:
75 TryExitingStartup(); 75 TryExitingStartup();
76 break; 76 break;
77 case DRAIN: 77 case DRAIN:
78 TryExitingDrain(now); 78 TryExitingDrain(now_ms);
79 break; 79 break;
80 case PROBE_BW: 80 case PROBE_BW:
81 TryUpdatingCyclePhase(now); 81 TryUpdatingCyclePhase(now_ms);
82 break; 82 break;
83 case PROBE_RTT: 83 case PROBE_RTT:
84 TryExitingProbeRtt(now); 84 TryExitingProbeRtt(now_ms);
85 break; 85 break;
86 } 86 }
87 TryEnteringProbeRtt(now); 87 TryEnteringProbeRtt(now_ms);
88 // TODO(gnish): implement functions updating congestion window and pacing rate 88 // TODO(gnish): implement functions updating congestion window and pacing rate
89 // controllers. 89 // controllers.
90 } 90 }
91 91
92 bool BbrBweSender::UpdateBandwidthAndMinRtt() { 92 bool BbrBweSender::UpdateBandwidthAndMinRtt() {
93 return false; 93 return false;
94 } 94 }
95 95
96 void BbrBweSender::EnterStartup() { 96 void BbrBweSender::EnterStartup() {
97 mode_ = STARTUP; 97 mode_ = STARTUP;
98 pacing_gain_ = kHighGain; 98 pacing_gain_ = kHighGain;
99 congestion_window_gain_ = kHighGain; 99 congestion_window_gain_ = kHighGain;
100 } 100 }
101 101
102 void BbrBweSender::TryExitingStartup() { 102 void BbrBweSender::TryExitingStartup() {
103 if (full_bandwidth_reached_) { 103 if (full_bandwidth_reached_) {
104 mode_ = DRAIN; 104 mode_ = DRAIN;
105 pacing_gain_ = kDrainGain; 105 pacing_gain_ = kDrainGain;
106 congestion_window_gain_ = kHighGain; 106 congestion_window_gain_ = kHighGain;
107 } 107 }
108 } 108 }
109 109
110 void BbrBweSender::TryExitingDrain(int64_t now) {} 110 void BbrBweSender::TryExitingDrain(int64_t now_ms) {}
111 111
112 void BbrBweSender::EnterProbeBw(int64_t now) {} 112 void BbrBweSender::EnterProbeBw(int64_t now_ms) {}
113 113
114 void BbrBweSender::TryUpdatingCyclePhase(int64_t now) {} 114 void BbrBweSender::TryUpdatingCyclePhase(int64_t now_ms) {}
115 115
116 void BbrBweSender::TryEnteringProbeRtt(int64_t now) {} 116 void BbrBweSender::TryEnteringProbeRtt(int64_t now_ms) {}
117 void BbrBweSender::TryExitingProbeRtt(int64_t now) {} 117 void BbrBweSender::TryExitingProbeRtt(int64_t now_ms) {}
118 118
119 int64_t BbrBweSender::TimeUntilNextProcess() { 119 int64_t BbrBweSender::TimeUntilNextProcess() {
120 return 100; 120 return 100;
121 } 121 }
122 122
123 void BbrBweSender::OnPacketsSent(const Packets& packets) { 123 void BbrBweSender::OnPacketsSent(const Packets& packets) {
124 last_packet_sent_ = 124 last_packet_sent_ =
125 static_cast<const MediaPacket*>(packets.back())->sequence_number(); 125 static_cast<const MediaPacket*>(packets.back())->sequence_number();
126 } 126 }
127 127
128 void BbrBweSender::Process() {} 128 void BbrBweSender::Process() {}
129 129
130 BbrBweReceiver::BbrBweReceiver(int flow_id) 130 BbrBweReceiver::BbrBweReceiver(int flow_id)
131 : BweReceiver(flow_id, kReceivingRateTimeWindowMs), clock_(0) {} 131 : BweReceiver(flow_id, kReceivingRateTimeWindowMs), clock_(0) {}
132 132
133 BbrBweReceiver::~BbrBweReceiver() {} 133 BbrBweReceiver::~BbrBweReceiver() {}
134 134
135 void BbrBweReceiver::ReceivePacket(int64_t arrival_time_ms, 135 void BbrBweReceiver::ReceivePacket(int64_t arrival_time_ms,
136 const MediaPacket& media_packet) {} 136 const MediaPacket& media_packet) {}
137 137
138 FeedbackPacket* BbrBweReceiver::GetFeedback(int64_t now_ms) { 138 FeedbackPacket* BbrBweReceiver::GetFeedback(int64_t now_ms) {
139 return nullptr; 139 return nullptr;
140 } 140 }
141 } // namespace bwe 141 } // namespace bwe
142 } // namespace testing 142 } // namespace testing
143 } // namespace webrtc 143 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698