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

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

Issue 1932683002: Remove ViEEncoder::SetNetworkStatus (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_pacer
Patch Set: Addressed comments Created 4 years, 8 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 | webrtc/modules/congestion_controller/congestion_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/congestion_controller/congestion_controller.cc
diff --git a/webrtc/modules/congestion_controller/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc
index f3a8432310cb257ddc33bd978b623a7c2756422b..f93d1b368121d6dc45db29aff01c4f24945aac9c 100644
--- a/webrtc/modules/congestion_controller/congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller.cc
@@ -151,7 +151,8 @@ CongestionController::CongestionController(
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
- send_queue_is_full_(false) {
+ last_reported_bitrate_bps_(0),
+ network_state_(kNetworkUp) {
Init();
}
@@ -173,7 +174,8 @@ CongestionController::CongestionController(
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
- send_queue_is_full_(false) {
+ last_reported_bitrate_bps_(0),
+ network_state_(kNetworkUp) {
Init();
}
@@ -251,6 +253,8 @@ void CongestionController::SignalNetworkState(NetworkState state) {
} else {
pacer_->Pause();
}
+ rtc::CritScope cs(&critsect_);
+ network_state_ = state;
}
void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) {
@@ -278,24 +282,31 @@ void CongestionController::MaybeTriggerOnNetworkChanged() {
uint32_t bitrate_bps;
uint8_t fraction_loss;
int64_t rtt;
- bool network_changed = bitrate_controller_->GetNetworkParameters(
+ bool estimate_changed = bitrate_controller_->GetNetworkParameters(
&bitrate_bps, &fraction_loss, &rtt);
- if (network_changed)
+ if (estimate_changed)
pacer_->SetEstimatedBitrate(bitrate_bps);
- bool send_queue_is_full =
- pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
- bitrate_bps = send_queue_is_full ? 0 : bitrate_bps;
- if ((network_changed && !send_queue_is_full) ||
- UpdateSendQueueStatus(send_queue_is_full)) {
+
+ bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps;
+
+ if (HasBitrateToReportChanged(bitrate_bps)) {
observer_->OnNetworkChanged(bitrate_bps, fraction_loss, rtt);
}
}
+bool CongestionController::HasBitrateToReportChanged(uint32_t bitrate_bps) {
stefan-webrtc 2016/05/04 09:21:20 Empty line above.
perkj_webrtc 2016/05/04 10:00:15 Done.
+ rtc::CritScope cs(&critsect_);
+ bool changed = last_reported_bitrate_bps_ != bitrate_bps;
+ last_reported_bitrate_bps_ = bitrate_bps;
+ return changed;
+}
+
+bool CongestionController::IsSendQueueFull() const {
+ return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
+}
-bool CongestionController::UpdateSendQueueStatus(bool send_queue_is_full) {
+bool CongestionController::IsNetworkDown() const {
rtc::CritScope cs(&critsect_);
- bool result = send_queue_is_full_ != send_queue_is_full;
- send_queue_is_full_ = send_queue_is_full;
- return result;
+ return network_state_ == kNetworkDown;
}
} // namespace webrtc
« no previous file with comments | « no previous file | webrtc/modules/congestion_controller/congestion_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698