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

Unified Diff: webrtc/modules/congestion_controller/send_side_congestion_controller.cc

Issue 3009673002: Move GetOutstandingBytes() call inside field trial check to avoid taking an unneccessary lock. (Closed)
Patch Set: Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/congestion_controller/send_side_congestion_controller.cc
diff --git a/webrtc/modules/congestion_controller/send_side_congestion_controller.cc b/webrtc/modules/congestion_controller/send_side_congestion_controller.cc
index c8fc990e03b867c2b7e65e3995387b0d993d1176..fee49902c52ed1f7e6aeb6060e54acf94e6a01ca 100644
--- a/webrtc/modules/congestion_controller/send_side_congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/send_side_congestion_controller.cc
@@ -295,7 +295,8 @@ void SendSideCongestionController::OnSentPacket(
return;
transport_feedback_adapter_.OnSentPacket(sent_packet.packet_id,
sent_packet.send_time_ms);
- LimitOutstandingBytes(transport_feedback_adapter_.GetOutstandingBytes());
+ if (in_cwnd_experiment_)
+ LimitOutstandingBytes(transport_feedback_adapter_.GetOutstandingBytes());
}
void SendSideCongestionController::OnRttUpdate(int64_t avg_rtt_ms,
@@ -369,34 +370,32 @@ void SendSideCongestionController::OnTransportFeedback(
}
if (result.recovered_from_overuse)
probe_controller_->RequestProbe();
- LimitOutstandingBytes(transport_feedback_adapter_.GetOutstandingBytes());
+ if (in_cwnd_experiment_)
+ LimitOutstandingBytes(transport_feedback_adapter_.GetOutstandingBytes());
}
void SendSideCongestionController::LimitOutstandingBytes(
size_t num_outstanding_bytes) {
- if (!in_cwnd_experiment_)
+ RTC_DCHECK(in_cwnd_experiment_);
+ rtc::CritScope lock(&network_state_lock_);
+ rtc::Optional<int64_t> min_rtt_ms =
+ transport_feedback_adapter_.GetMinFeedbackLoopRtt();
+ // No valid RTT. Could be because send-side BWE isn't used, in which case
+ // we don't try to limit the outstanding packets.
+ if (!min_rtt_ms)
return;
- {
- rtc::CritScope lock(&network_state_lock_);
- rtc::Optional<int64_t> min_rtt_ms =
- transport_feedback_adapter_.GetMinFeedbackLoopRtt();
- // No valid RTT. Could be because send-side BWE isn't used, in which case
- // we don't try to limit the outstanding packets.
- if (!min_rtt_ms)
- return;
- const size_t kMinCwndBytes = 2 * 1500;
- size_t max_outstanding_bytes =
- std::max<size_t>((*min_rtt_ms + accepted_queue_ms_) *
- last_reported_bitrate_bps_ / 1000 / 8,
- kMinCwndBytes);
- LOG(LS_INFO) << clock_->TimeInMilliseconds()
- << " Outstanding bytes: " << num_outstanding_bytes
- << " pacer queue: " << pacer_->QueueInMs()
- << " max outstanding: " << max_outstanding_bytes;
- LOG(LS_INFO) << "Feedback rtt: " << *min_rtt_ms
- << " Bitrate: " << last_reported_bitrate_bps_;
- pause_pacer_ = num_outstanding_bytes > max_outstanding_bytes;
- }
+ const size_t kMinCwndBytes = 2 * 1500;
+ size_t max_outstanding_bytes =
+ std::max<size_t>((*min_rtt_ms + accepted_queue_ms_) *
+ last_reported_bitrate_bps_ / 1000 / 8,
+ kMinCwndBytes);
+ LOG(LS_INFO) << clock_->TimeInMilliseconds()
+ << " Outstanding bytes: " << num_outstanding_bytes
+ << " pacer queue: " << pacer_->QueueInMs()
+ << " max outstanding: " << max_outstanding_bytes;
+ LOG(LS_INFO) << "Feedback rtt: " << *min_rtt_ms
+ << " Bitrate: " << last_reported_bitrate_bps_;
+ pause_pacer_ = num_outstanding_bytes > max_outstanding_bytes;
}
std::vector<PacketFeedback>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698