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

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

Issue 1978783002: Revert of Remove ViEEncoder::SetNetworkStatus (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_pacer
Patch Set: Created 4 years, 7 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 ab3a90c2ecc6ee42efedf7086e971f8fbd5edef5..157258291ae92df4ea30a85a8206729886123dd7 100644
--- a/webrtc/modules/congestion_controller/congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller.cc
@@ -151,10 +151,7 @@
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
- last_reported_bitrate_bps_(0),
- last_reported_fraction_loss_(0),
- last_reported_rtt_(0),
- network_state_(kNetworkUp) {
+ send_queue_is_full_(false) {
Init();
}
@@ -173,10 +170,7 @@
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
- last_reported_bitrate_bps_(0),
- last_reported_fraction_loss_(0),
- last_reported_rtt_(0),
- network_state_(kNetworkUp) {
+ send_queue_is_full_(false) {
Init();
}
@@ -198,10 +192,7 @@
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
- last_reported_bitrate_bps_(0),
- last_reported_fraction_loss_(0),
- last_reported_rtt_(0),
- network_state_(kNetworkUp) {
+ send_queue_is_full_(false) {
Init();
}
@@ -274,11 +265,6 @@
} else {
pacer_->Pause();
}
- {
- rtc::CritScope cs(&critsect_);
- network_state_ = state;
- }
- MaybeTriggerOnNetworkChanged();
}
void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) {
@@ -311,40 +297,24 @@
uint32_t bitrate_bps;
uint8_t fraction_loss;
int64_t rtt;
- bool estimate_changed = bitrate_controller_->GetNetworkParameters(
+ bool network_changed = bitrate_controller_->GetNetworkParameters(
&bitrate_bps, &fraction_loss, &rtt);
- if (estimate_changed)
+ if (network_changed)
pacer_->SetEstimatedBitrate(bitrate_bps);
-
- bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps;
-
- if (HasNetworkParametersToReportChanged(bitrate_bps, fraction_loss, rtt)) {
+ 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)) {
observer_->OnNetworkChanged(bitrate_bps, fraction_loss, rtt);
}
}
-bool CongestionController::HasNetworkParametersToReportChanged(
- uint32_t bitrate_bps,
- uint8_t fraction_loss,
- int64_t rtt) {
+bool CongestionController::UpdateSendQueueStatus(bool send_queue_is_full) {
rtc::CritScope cs(&critsect_);
- bool changed =
- last_reported_bitrate_bps_ != bitrate_bps ||
- (bitrate_bps > 0 && (last_reported_fraction_loss_ != fraction_loss ||
- last_reported_rtt_ != rtt));
- last_reported_bitrate_bps_ = bitrate_bps;
- last_reported_fraction_loss_ = fraction_loss;
- last_reported_rtt_ = rtt;
- return changed;
-}
-
-bool CongestionController::IsSendQueueFull() const {
- return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
-}
-
-bool CongestionController::IsNetworkDown() const {
- rtc::CritScope cs(&critsect_);
- return network_state_ == kNetworkDown;
+ bool result = send_queue_is_full_ != send_queue_is_full;
+ send_queue_is_full_ = send_queue_is_full;
+ return result;
}
} // 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