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

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

Issue 2867713003: Remove hardcoded kValueSizeBytes values from variable-length header extensions. (Closed)
Patch Set: use RaceChecker instead of ThreadChecker in a few places. 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) 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
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 retransmission_rate_limiter_( 94 retransmission_rate_limiter_(
95 new RateLimiter(clock, kRetransmitWindowSizeMs)), 95 new RateLimiter(clock, kRetransmitWindowSizeMs)),
96 transport_feedback_adapter_(clock_), 96 transport_feedback_adapter_(clock_),
97 last_reported_bitrate_bps_(0), 97 last_reported_bitrate_bps_(0),
98 last_reported_fraction_loss_(0), 98 last_reported_fraction_loss_(0),
99 last_reported_rtt_(0), 99 last_reported_rtt_(0),
100 network_state_(kNetworkUp), 100 network_state_(kNetworkUp),
101 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()), 101 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
102 delay_based_bwe_(new DelayBasedBwe(event_log_, clock_)) { 102 delay_based_bwe_(new DelayBasedBwe(event_log_, clock_)) {
103 delay_based_bwe_->SetMinBitrate(min_bitrate_bps_); 103 delay_based_bwe_->SetMinBitrate(min_bitrate_bps_);
104 worker_thread_checker_.DetachFromThread();
105 } 104 }
106 105
107 SendSideCongestionController::~SendSideCongestionController() {} 106 SendSideCongestionController::~SendSideCongestionController() {}
108 107
109 void SendSideCongestionController::RegisterPacketFeedbackObserver( 108 void SendSideCongestionController::RegisterPacketFeedbackObserver(
110 PacketFeedbackObserver* observer) { 109 PacketFeedbackObserver* observer) {
111 transport_feedback_adapter_.RegisterPacketFeedbackObserver(observer); 110 transport_feedback_adapter_.RegisterPacketFeedbackObserver(observer);
112 } 111 }
113 112
114 void SendSideCongestionController::DeRegisterPacketFeedbackObserver( 113 void SendSideCongestionController::DeRegisterPacketFeedbackObserver(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 uint32_t ssrc, 265 uint32_t ssrc,
267 uint16_t sequence_number, 266 uint16_t sequence_number,
268 size_t length, 267 size_t length,
269 const PacedPacketInfo& pacing_info) { 268 const PacedPacketInfo& pacing_info) {
270 transport_feedback_adapter_.AddPacket(ssrc, sequence_number, length, 269 transport_feedback_adapter_.AddPacket(ssrc, sequence_number, length,
271 pacing_info); 270 pacing_info);
272 } 271 }
273 272
274 void SendSideCongestionController::OnTransportFeedback( 273 void SendSideCongestionController::OnTransportFeedback(
275 const rtcp::TransportFeedback& feedback) { 274 const rtcp::TransportFeedback& feedback) {
276 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 275 RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
277 transport_feedback_adapter_.OnTransportFeedback(feedback); 276 transport_feedback_adapter_.OnTransportFeedback(feedback);
278 std::vector<PacketFeedback> feedback_vector = ReceivedPacketFeedbackVector( 277 std::vector<PacketFeedback> feedback_vector = ReceivedPacketFeedbackVector(
279 transport_feedback_adapter_.GetTransportFeedbackVector()); 278 transport_feedback_adapter_.GetTransportFeedbackVector());
280 SortPacketFeedbackVector(&feedback_vector); 279 SortPacketFeedbackVector(&feedback_vector);
281 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector( 280 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector(
282 feedback_vector); 281 feedback_vector);
283 DelayBasedBwe::Result result; 282 DelayBasedBwe::Result result;
284 { 283 {
285 rtc::CritScope cs(&bwe_lock_); 284 rtc::CritScope cs(&bwe_lock_);
286 result = delay_based_bwe_->IncomingPacketFeedbackVector( 285 result = delay_based_bwe_->IncomingPacketFeedbackVector(
287 feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps()); 286 feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps());
288 } 287 }
289 if (result.updated) 288 if (result.updated)
290 bitrate_controller_->OnDelayBasedBweResult(result); 289 bitrate_controller_->OnDelayBasedBweResult(result);
291 } 290 }
292 291
293 std::vector<PacketFeedback> 292 std::vector<PacketFeedback>
294 SendSideCongestionController::GetTransportFeedbackVector() const { 293 SendSideCongestionController::GetTransportFeedbackVector() const {
295 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 294 RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
296 return transport_feedback_adapter_.GetTransportFeedbackVector(); 295 return transport_feedback_adapter_.GetTransportFeedbackVector();
297 } 296 }
298 297
299 void SendSideCongestionController::MaybeTriggerOnNetworkChanged() { 298 void SendSideCongestionController::MaybeTriggerOnNetworkChanged() {
300 uint32_t bitrate_bps; 299 uint32_t bitrate_bps;
301 uint8_t fraction_loss; 300 uint8_t fraction_loss;
302 int64_t rtt; 301 int64_t rtt;
303 bool estimate_changed = bitrate_controller_->GetNetworkParameters( 302 bool estimate_changed = bitrate_controller_->GetNetworkParameters(
304 &bitrate_bps, &fraction_loss, &rtt); 303 &bitrate_bps, &fraction_loss, &rtt);
305 if (estimate_changed) { 304 if (estimate_changed) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 bool SendSideCongestionController::IsSendQueueFull() const { 347 bool SendSideCongestionController::IsSendQueueFull() const {
349 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; 348 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
350 } 349 }
351 350
352 bool SendSideCongestionController::IsNetworkDown() const { 351 bool SendSideCongestionController::IsNetworkDown() const {
353 rtc::CritScope cs(&network_state_lock_); 352 rtc::CritScope cs(&network_state_lock_);
354 return network_state_ == kNetworkDown; 353 return network_state_ == kNetworkDown;
355 } 354 }
356 355
357 } // namespace webrtc 356 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/include/send_side_congestion_controller.h ('k') | webrtc/modules/pacing/packet_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698