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

Side by Side Diff: webrtc/modules/congestion_controller/congestion_controller.cc

Issue 2642363003: Make CongestionController::remote_bitrate_estimator_ a non-pointer. (Closed)
Patch Set: Created 3 years, 11 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 11 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <memory> 14 #include <memory>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/base/rate_limiter.h" 19 #include "webrtc/base/rate_limiter.h"
20 #include "webrtc/base/socket.h" 20 #include "webrtc/base/socket.h"
21 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" 21 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
22 #include "webrtc/modules/congestion_controller/probe_controller.h" 22 #include "webrtc/modules/congestion_controller/probe_controller.h"
23 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" 23 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
24 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h" 24 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h"
25 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h" 25 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h"
26 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
27 26
28 namespace webrtc { 27 namespace webrtc {
29 namespace { 28 namespace {
30 29
31 static const uint32_t kTimeOffsetSwitchThreshold = 30; 30 static const uint32_t kTimeOffsetSwitchThreshold = 30;
32 static const int64_t kRetransmitWindowSizeMs = 500; 31 static const int64_t kRetransmitWindowSizeMs = 500;
33 32
34 // Makes sure that the bitrate and the min, max values are in valid range. 33 // Makes sure that the bitrate and the min, max values are in valid range.
35 static void ClampBitrates(int* bitrate_bps, 34 static void ClampBitrates(int* bitrate_bps,
36 int* min_bitrate_bps, 35 int* min_bitrate_bps,
37 int* max_bitrate_bps) { 36 int* max_bitrate_bps) {
38 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, 37 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps,
39 // and that we don't try to set the min bitrate to 0 from any applications. 38 // and that we don't try to set the min bitrate to 0 from any applications.
40 // The congestion controller should allow a min bitrate of 0. 39 // The congestion controller should allow a min bitrate of 0.
41 if (*min_bitrate_bps < congestion_controller::GetMinBitrateBps()) 40 if (*min_bitrate_bps < congestion_controller::GetMinBitrateBps())
42 *min_bitrate_bps = congestion_controller::GetMinBitrateBps(); 41 *min_bitrate_bps = congestion_controller::GetMinBitrateBps();
43 if (*max_bitrate_bps > 0) 42 if (*max_bitrate_bps > 0)
44 *max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps); 43 *max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps);
45 if (*bitrate_bps > 0) 44 if (*bitrate_bps > 0)
46 *bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps); 45 *bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps);
47 } 46 }
48 47
49 class WrappingBitrateEstimator : public RemoteBitrateEstimator { 48 } // namespace
50 public:
51 WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock)
52 : observer_(observer),
53 clock_(clock),
54 crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
55 rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)),
56 using_absolute_send_time_(false),
57 packets_since_absolute_send_time_(0),
58 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()) {}
59 49
60 virtual ~WrappingBitrateEstimator() {} 50 CongestionController::WrappingBitrateEstimator::WrappingBitrateEstimator(
51 RemoteBitrateObserver* observer, Clock* clock)
52 : observer_(observer),
53 clock_(clock),
54 rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)),
55 using_absolute_send_time_(false),
56 packets_since_absolute_send_time_(0),
57 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()) {}
61 58
62 void IncomingPacket(int64_t arrival_time_ms, 59 void CongestionController::WrappingBitrateEstimator::IncomingPacket(
63 size_t payload_size, 60 int64_t arrival_time_ms,
64 const RTPHeader& header) override { 61 size_t payload_size,
65 CriticalSectionScoped cs(crit_sect_.get()); 62 const RTPHeader& header) {
66 PickEstimatorFromHeader(header); 63 rtc::CritScope cs(&crit_sect_);
67 rbe_->IncomingPacket(arrival_time_ms, payload_size, header); 64 PickEstimatorFromHeader(header);
68 } 65 rbe_->IncomingPacket(arrival_time_ms, payload_size, header);
66 }
69 67
70 void Process() override { 68 void CongestionController::WrappingBitrateEstimator::Process() {
71 CriticalSectionScoped cs(crit_sect_.get()); 69 rtc::CritScope cs(&crit_sect_);
72 rbe_->Process(); 70 rbe_->Process();
73 } 71 }
74 72
75 int64_t TimeUntilNextProcess() override { 73 int64_t CongestionController::WrappingBitrateEstimator::TimeUntilNextProcess() {
76 CriticalSectionScoped cs(crit_sect_.get()); 74 rtc::CritScope cs(&crit_sect_);
77 return rbe_->TimeUntilNextProcess(); 75 return rbe_->TimeUntilNextProcess();
78 } 76 }
79 77
80 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override { 78 void CongestionController::WrappingBitrateEstimator::OnRttUpdate(
81 CriticalSectionScoped cs(crit_sect_.get()); 79 int64_t avg_rtt_ms, int64_t max_rtt_ms) {
82 rbe_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); 80 rtc::CritScope cs(&crit_sect_);
83 } 81 rbe_->OnRttUpdate(avg_rtt_ms, max_rtt_ms);
82 }
84 83
85 void RemoveStream(unsigned int ssrc) override { 84 void CongestionController::WrappingBitrateEstimator::RemoveStream(
86 CriticalSectionScoped cs(crit_sect_.get()); 85 unsigned int ssrc) {
87 rbe_->RemoveStream(ssrc); 86 rtc::CritScope cs(&crit_sect_);
88 } 87 rbe_->RemoveStream(ssrc);
88 }
89 89
90 bool LatestEstimate(std::vector<unsigned int>* ssrcs, 90 bool CongestionController::WrappingBitrateEstimator::LatestEstimate(
91 unsigned int* bitrate_bps) const override { 91 std::vector<unsigned int>* ssrcs,
92 CriticalSectionScoped cs(crit_sect_.get()); 92 unsigned int* bitrate_bps) const {
93 return rbe_->LatestEstimate(ssrcs, bitrate_bps); 93 rtc::CritScope cs(&crit_sect_);
94 } 94 return rbe_->LatestEstimate(ssrcs, bitrate_bps);
95 }
95 96
96 void SetMinBitrate(int min_bitrate_bps) override { 97 void CongestionController::WrappingBitrateEstimator::SetMinBitrate(
97 CriticalSectionScoped cs(crit_sect_.get()); 98 int min_bitrate_bps) {
98 rbe_->SetMinBitrate(min_bitrate_bps); 99 rtc::CritScope cs(&crit_sect_);
99 min_bitrate_bps_ = min_bitrate_bps; 100 rbe_->SetMinBitrate(min_bitrate_bps);
100 } 101 min_bitrate_bps_ = min_bitrate_bps;
102 }
101 103
102 private: 104 void CongestionController::WrappingBitrateEstimator::PickEstimatorFromHeader(
103 void PickEstimatorFromHeader(const RTPHeader& header) 105 const RTPHeader& header) {
104 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()) { 106 if (header.extension.hasAbsoluteSendTime) {
105 if (header.extension.hasAbsoluteSendTime) { 107 // If we see AST in header, switch RBE strategy immediately.
106 // If we see AST in header, switch RBE strategy immediately. 108 if (!using_absolute_send_time_) {
107 if (!using_absolute_send_time_) { 109 LOG(LS_INFO) <<
108 LOG(LS_INFO) << 110 "WrappingBitrateEstimator: Switching to absolute send time RBE.";
109 "WrappingBitrateEstimator: Switching to absolute send time RBE."; 111 using_absolute_send_time_ = true;
110 using_absolute_send_time_ = true; 112 PickEstimator();
113 }
114 packets_since_absolute_send_time_ = 0;
115 } else {
116 // When we don't see AST, wait for a few packets before going back to TOF.
117 if (using_absolute_send_time_) {
118 ++packets_since_absolute_send_time_;
119 if (packets_since_absolute_send_time_ >= kTimeOffsetSwitchThreshold) {
120 LOG(LS_INFO) << "WrappingBitrateEstimator: Switching to transmission "
121 << "time offset RBE.";
122 using_absolute_send_time_ = false;
111 PickEstimator(); 123 PickEstimator();
112 } 124 }
113 packets_since_absolute_send_time_ = 0;
114 } else {
115 // When we don't see AST, wait for a few packets before going back to TOF.
116 if (using_absolute_send_time_) {
117 ++packets_since_absolute_send_time_;
118 if (packets_since_absolute_send_time_ >= kTimeOffsetSwitchThreshold) {
119 LOG(LS_INFO) << "WrappingBitrateEstimator: Switching to transmission "
120 << "time offset RBE.";
121 using_absolute_send_time_ = false;
122 PickEstimator();
123 }
124 }
125 } 125 }
126 } 126 }
127 }
127 128
128 // Instantiate RBE for Time Offset or Absolute Send Time extensions. 129 // Instantiate RBE for Time Offset or Absolute Send Time extensions.
129 void PickEstimator() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()) { 130 void CongestionController::WrappingBitrateEstimator::PickEstimator() {
130 if (using_absolute_send_time_) { 131 if (using_absolute_send_time_) {
131 rbe_.reset(new RemoteBitrateEstimatorAbsSendTime(observer_, clock_)); 132 rbe_.reset(new RemoteBitrateEstimatorAbsSendTime(observer_, clock_));
132 } else { 133 } else {
133 rbe_.reset(new RemoteBitrateEstimatorSingleStream(observer_, clock_)); 134 rbe_.reset(new RemoteBitrateEstimatorSingleStream(observer_, clock_));
134 }
135 rbe_->SetMinBitrate(min_bitrate_bps_);
136 } 135 }
137 136 rbe_->SetMinBitrate(min_bitrate_bps_);
138 RemoteBitrateObserver* observer_; 137 }
139 Clock* const clock_;
140 std::unique_ptr<CriticalSectionWrapper> crit_sect_;
141 std::unique_ptr<RemoteBitrateEstimator> rbe_;
142 bool using_absolute_send_time_;
143 uint32_t packets_since_absolute_send_time_;
144 int min_bitrate_bps_;
145
146 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator);
147 };
148
149 } // namespace
150 138
151 CongestionController::CongestionController( 139 CongestionController::CongestionController(
152 Clock* clock, 140 Clock* clock,
153 Observer* observer, 141 Observer* observer,
154 RemoteBitrateObserver* remote_bitrate_observer, 142 RemoteBitrateObserver* remote_bitrate_observer,
155 RtcEventLog* event_log, 143 RtcEventLog* event_log,
156 PacketRouter* packet_router) 144 PacketRouter* packet_router)
157 : CongestionController( 145 : CongestionController(
158 clock, 146 clock,
159 observer, 147 observer,
160 remote_bitrate_observer, 148 remote_bitrate_observer,
161 event_log, 149 event_log,
162 packet_router, 150 packet_router,
163 std::unique_ptr<PacedSender>(new PacedSender(clock, packet_router))) { 151 std::unique_ptr<PacedSender>(new PacedSender(clock, packet_router))) {
164 } 152 }
165 153
166 CongestionController::CongestionController( 154 CongestionController::CongestionController(
167 Clock* clock, 155 Clock* clock,
168 Observer* observer, 156 Observer* observer,
169 RemoteBitrateObserver* remote_bitrate_observer, 157 RemoteBitrateObserver* remote_bitrate_observer,
170 RtcEventLog* event_log, 158 RtcEventLog* event_log,
171 PacketRouter* packet_router, 159 PacketRouter* packet_router,
172 std::unique_ptr<PacedSender> pacer) 160 std::unique_ptr<PacedSender> pacer)
173 : clock_(clock), 161 : clock_(clock),
174 observer_(observer), 162 observer_(observer),
175 packet_router_(packet_router), 163 packet_router_(packet_router),
176 pacer_(std::move(pacer)), 164 pacer_(std::move(pacer)),
177 remote_bitrate_estimator_( 165 remote_bitrate_estimator_(remote_bitrate_observer, clock_),
178 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
179 // Constructed last as this object calls the provided callback on 166 // Constructed last as this object calls the provided callback on
180 // construction. 167 // construction.
181 bitrate_controller_( 168 bitrate_controller_(
182 BitrateController::CreateBitrateController(clock_, event_log)), 169 BitrateController::CreateBitrateController(clock_, event_log)),
183 probe_controller_(new ProbeController(pacer_.get(), clock_)), 170 probe_controller_(new ProbeController(pacer_.get(), clock_)),
184 retransmission_rate_limiter_( 171 retransmission_rate_limiter_(
185 new RateLimiter(clock, kRetransmitWindowSizeMs)), 172 new RateLimiter(clock, kRetransmitWindowSizeMs)),
186 remote_estimator_proxy_(clock_, packet_router_), 173 remote_estimator_proxy_(clock_, packet_router_),
187 transport_feedback_adapter_(clock_, bitrate_controller_.get()), 174 transport_feedback_adapter_(clock_, bitrate_controller_.get()),
188 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()), 175 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
189 max_bitrate_bps_(0), 176 max_bitrate_bps_(0),
190 last_reported_bitrate_bps_(0), 177 last_reported_bitrate_bps_(0),
191 last_reported_fraction_loss_(0), 178 last_reported_fraction_loss_(0),
192 last_reported_rtt_(0), 179 last_reported_rtt_(0),
193 network_state_(kNetworkUp) { 180 network_state_(kNetworkUp) {
194 transport_feedback_adapter_.InitBwe(); 181 transport_feedback_adapter_.InitBwe();
195 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps_); 182 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps_);
196 } 183 }
197 184
198 CongestionController::~CongestionController() {} 185 CongestionController::~CongestionController() {}
199 186
200 void CongestionController::OnReceivedPacket(int64_t arrival_time_ms, 187 void CongestionController::OnReceivedPacket(int64_t arrival_time_ms,
201 size_t payload_size, 188 size_t payload_size,
202 const RTPHeader& header) { 189 const RTPHeader& header) {
203 // Send-side BWE. 190 // Send-side BWE.
204 if (header.extension.hasTransportSequenceNumber) { 191 if (header.extension.hasTransportSequenceNumber) {
205 remote_estimator_proxy_.IncomingPacket(arrival_time_ms, payload_size, 192 remote_estimator_proxy_.IncomingPacket(arrival_time_ms, payload_size,
206 header); 193 header);
207 return; 194 } else {
208 } 195 // Receive-side BWE.
209 196 remote_bitrate_estimator_.IncomingPacket(arrival_time_ms, payload_size,
210 // Receive-side BWE.
211 if (remote_bitrate_estimator_) {
212 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size,
213 header); 197 header);
214 } 198 }
215 } 199 }
216 200
217 void CongestionController::SetBweBitrates(int min_bitrate_bps, 201 void CongestionController::SetBweBitrates(int min_bitrate_bps,
218 int start_bitrate_bps, 202 int start_bitrate_bps,
219 int max_bitrate_bps) { 203 int max_bitrate_bps) {
220 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); 204 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps);
221 bitrate_controller_->SetBitrates(start_bitrate_bps, 205 bitrate_controller_->SetBitrates(start_bitrate_bps,
222 min_bitrate_bps, 206 min_bitrate_bps,
223 max_bitrate_bps); 207 max_bitrate_bps);
224 208
225 probe_controller_->SetBitrates(min_bitrate_bps, start_bitrate_bps, 209 probe_controller_->SetBitrates(min_bitrate_bps, start_bitrate_bps,
226 max_bitrate_bps); 210 max_bitrate_bps);
227 max_bitrate_bps_ = max_bitrate_bps; 211 max_bitrate_bps_ = max_bitrate_bps;
228 212
229 if (remote_bitrate_estimator_) 213 remote_bitrate_estimator_.SetMinBitrate(min_bitrate_bps);
230 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps);
231 min_bitrate_bps_ = min_bitrate_bps; 214 min_bitrate_bps_ = min_bitrate_bps;
232 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps_); 215 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps_);
233 MaybeTriggerOnNetworkChanged(); 216 MaybeTriggerOnNetworkChanged();
234 } 217 }
235 218
236 void CongestionController::ResetBweAndBitrates(int bitrate_bps, 219 void CongestionController::ResetBweAndBitrates(int bitrate_bps,
237 int min_bitrate_bps, 220 int min_bitrate_bps,
238 int max_bitrate_bps) { 221 int max_bitrate_bps) {
239 ClampBitrates(&bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); 222 ClampBitrates(&bitrate_bps, &min_bitrate_bps, &max_bitrate_bps);
240 // TODO(honghaiz): Recreate this object once the bitrate controller is 223 // TODO(honghaiz): Recreate this object once the bitrate controller is
241 // no longer exposed outside CongestionController. 224 // no longer exposed outside CongestionController.
242 bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps, 225 bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps,
243 max_bitrate_bps); 226 max_bitrate_bps);
244 min_bitrate_bps_ = min_bitrate_bps; 227 min_bitrate_bps_ = min_bitrate_bps;
245 max_bitrate_bps_ = max_bitrate_bps; 228 max_bitrate_bps_ = max_bitrate_bps;
246 // TODO(honghaiz): Recreate this object once the remote bitrate estimator is 229 // TODO(honghaiz): Recreate this object once the remote bitrate estimator is
247 // no longer exposed outside CongestionController. 230 // no longer exposed outside CongestionController.
248 if (remote_bitrate_estimator_) 231 remote_bitrate_estimator_.SetMinBitrate(min_bitrate_bps);
249 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps);
250 232
251 transport_feedback_adapter_.InitBwe(); 233 transport_feedback_adapter_.InitBwe();
252 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps); 234 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps);
253 // TODO(holmer): Trigger a new probe once mid-call probing is implemented. 235 // TODO(holmer): Trigger a new probe once mid-call probing is implemented.
254 MaybeTriggerOnNetworkChanged(); 236 MaybeTriggerOnNetworkChanged();
255 } 237 }
256 238
257 BitrateController* CongestionController::GetBitrateController() const { 239 BitrateController* CongestionController::GetBitrateController() const {
258 return bitrate_controller_.get(); 240 return bitrate_controller_.get();
259 } 241 }
260 242
261 RemoteBitrateEstimator* CongestionController::GetRemoteBitrateEstimator( 243 RemoteBitrateEstimator* CongestionController::GetRemoteBitrateEstimator(
262 bool send_side_bwe) { 244 bool send_side_bwe) {
263 if (send_side_bwe) { 245 if (send_side_bwe) {
264 return &remote_estimator_proxy_; 246 return &remote_estimator_proxy_;
265 } else { 247 } else {
266 return remote_bitrate_estimator_.get(); 248 return &remote_bitrate_estimator_;
267 } 249 }
268 } 250 }
269 251
270 TransportFeedbackObserver* 252 TransportFeedbackObserver*
271 CongestionController::GetTransportFeedbackObserver() { 253 CongestionController::GetTransportFeedbackObserver() {
272 return &transport_feedback_adapter_; 254 return &transport_feedback_adapter_;
273 } 255 }
274 256
275 RateLimiter* CongestionController::GetRetransmissionRateLimiter() { 257 RateLimiter* CongestionController::GetRetransmissionRateLimiter() {
276 return retransmission_rate_limiter_.get(); 258 return retransmission_rate_limiter_.get();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { 297 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) {
316 // We're not interested in packets without an id, which may be stun packets, 298 // We're not interested in packets without an id, which may be stun packets,
317 // etc, sent on the same transport. 299 // etc, sent on the same transport.
318 if (sent_packet.packet_id == -1) 300 if (sent_packet.packet_id == -1)
319 return; 301 return;
320 transport_feedback_adapter_.OnSentPacket(sent_packet.packet_id, 302 transport_feedback_adapter_.OnSentPacket(sent_packet.packet_id,
321 sent_packet.send_time_ms); 303 sent_packet.send_time_ms);
322 } 304 }
323 305
324 void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { 306 void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
325 remote_bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); 307 remote_bitrate_estimator_.OnRttUpdate(avg_rtt_ms, max_rtt_ms);
326 transport_feedback_adapter_.OnRttUpdate(avg_rtt_ms, max_rtt_ms); 308 transport_feedback_adapter_.OnRttUpdate(avg_rtt_ms, max_rtt_ms);
327 } 309 }
328 310
329 int64_t CongestionController::TimeUntilNextProcess() { 311 int64_t CongestionController::TimeUntilNextProcess() {
330 return std::min(bitrate_controller_->TimeUntilNextProcess(), 312 return std::min(bitrate_controller_->TimeUntilNextProcess(),
331 remote_bitrate_estimator_->TimeUntilNextProcess()); 313 remote_bitrate_estimator_.TimeUntilNextProcess());
332 } 314 }
333 315
334 void CongestionController::Process() { 316 void CongestionController::Process() {
335 bitrate_controller_->Process(); 317 bitrate_controller_->Process();
336 remote_bitrate_estimator_->Process(); 318 remote_bitrate_estimator_.Process();
337 probe_controller_->Process(); 319 probe_controller_->Process();
338 MaybeTriggerOnNetworkChanged(); 320 MaybeTriggerOnNetworkChanged();
339 } 321 }
340 322
341 void CongestionController::MaybeTriggerOnNetworkChanged() { 323 void CongestionController::MaybeTriggerOnNetworkChanged() {
342 // TODO(perkj): |observer_| can be nullptr if the ctor that accepts a 324 // TODO(perkj): |observer_| can be nullptr if the ctor that accepts a
343 // BitrateObserver is used. Remove this check once the ctor is removed. 325 // BitrateObserver is used. Remove this check once the ctor is removed.
344 if (!observer_) 326 if (!observer_)
345 return; 327 return;
346 328
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 bool CongestionController::IsSendQueueFull() const { 369 bool CongestionController::IsSendQueueFull() const {
388 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; 370 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
389 } 371 }
390 372
391 bool CongestionController::IsNetworkDown() const { 373 bool CongestionController::IsNetworkDown() const {
392 rtc::CritScope cs(&critsect_); 374 rtc::CritScope cs(&critsect_);
393 return network_state_ == kNetworkDown; 375 return network_state_ == kNetworkDown;
394 } 376 }
395 377
396 } // namespace webrtc 378 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698