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

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

Issue 3004783002: Push back on the video encoder to avoid building queues in the pacer. (Closed)
Patch Set: feedback 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 | « webrtc/modules/congestion_controller/include/send_side_congestion_controller.h ('k') | 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 fee49902c52ed1f7e6aeb6060e54acf94e6a01ca..7ae98c7feee7cc31b58536d298c58f5dd4f218d3 100644
--- a/webrtc/modules/congestion_controller/send_side_congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/send_side_congestion_controller.cc
@@ -32,6 +32,7 @@ namespace webrtc {
namespace {
const char kCwndExperiment[] = "WebRTC-CwndExperiment";
+const char kPacerPushbackExperiment[] = "WebRTC-PacerPushbackExperiment";
const int64_t kDefaultAcceptedQueueMs = 250;
bool CwndExperimentEnabled() {
@@ -41,6 +42,10 @@ bool CwndExperimentEnabled() {
return experiment_string.find("Enabled") == 0;
}
+bool PacerPushbackExperimentEnabled() {
+ return webrtc::field_trial::IsEnabled(kPacerPushbackExperiment);
stefan-webrtc 2017/09/01 09:01:08 Might as well call this function directly below.
philipel 2017/09/01 11:46:19 Done.
+}
+
bool ReadCwndExperimentParameter(int64_t* accepted_queue_ms) {
RTC_DCHECK(accepted_queue_ms);
std::string experiment_string =
@@ -122,7 +127,8 @@ SendSideCongestionController::SendSideCongestionController(
delay_based_bwe_(new DelayBasedBwe(event_log_, clock_)),
in_cwnd_experiment_(CwndExperimentEnabled()),
accepted_queue_ms_(kDefaultAcceptedQueueMs),
- was_in_alr_(0) {
+ was_in_alr_(false),
+ pacer_pushback_experiment_(PacerPushbackExperimentEnabled()) {
delay_based_bwe_->SetMinBitrate(min_bitrate_bps_);
if (in_cwnd_experiment_ &&
!ReadCwndExperimentParameter(&accepted_queue_ms_)) {
@@ -159,7 +165,8 @@ SendSideCongestionController::SendSideCongestionController(
delay_based_bwe_(new DelayBasedBwe(event_log_, clock_)),
in_cwnd_experiment_(CwndExperimentEnabled()),
accepted_queue_ms_(kDefaultAcceptedQueueMs),
- was_in_alr_(0) {
+ was_in_alr_(false),
+ pacer_pushback_experiment_(PacerPushbackExperimentEnabled()) {
delay_based_bwe_->SetMinBitrate(min_bitrate_bps_);
if (in_cwnd_experiment_ &&
!ReadCwndExperimentParameter(&accepted_queue_ms_)) {
@@ -416,7 +423,25 @@ void SendSideCongestionController::MaybeTriggerOnNetworkChanged() {
retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
}
- bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps;
+ if (!pacer_pushback_experiment_) {
+ bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps;
+ } else {
+ if (IsNetworkDown()) {
+ bitrate_bps = 0;
+ } else {
+ int64_t queue_length_ms = pacer_->ExpectedQueueTimeMs();
+
+ if (queue_length_ms == 0) {
+ encoding_rate_ = 1.0;
+ } else if (queue_length_ms > 50) {
+ float encoding_rate = 1.0 - queue_length_ms / 1000.0;
+ encoding_rate_ = std::min(encoding_rate_, encoding_rate);
+ encoding_rate_ = std::max(encoding_rate_, 0.0f);
+ }
+
+ bitrate_bps *= encoding_rate_;
+ }
+ }
if (HasNetworkParametersToReportChanged(bitrate_bps, fraction_loss, rtt)) {
int64_t probing_interval_ms;
« no previous file with comments | « webrtc/modules/congestion_controller/include/send_side_congestion_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698