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

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

Issue 2146013002: Reland of actor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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/common_types.h ('k') | webrtc/modules/congestion_controller/include/congestion_controller.h » ('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 7582258185e4ab4b70c87720a9bc3ef702716afa..d1ab03af0f8fe92d54749fc5046dcc2c47362f38 100644
--- a/webrtc/modules/congestion_controller/congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller.cc
@@ -17,6 +17,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/logging.h"
+#include "webrtc/base/rate_limiter.h"
#include "webrtc/base/socket.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
@@ -32,6 +33,8 @@
namespace {
static const uint32_t kTimeOffsetSwitchThreshold = 30;
+static const int64_t kMinRetransmitWindowSizeMs = 30;
+static const int64_t kMaxRetransmitWindowSizeMs = 1000;
// Makes sure that the bitrate and the min, max values are in valid range.
static void ClampBitrates(int* bitrate_bps,
@@ -164,6 +167,8 @@
new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
bitrate_controller_(
BitrateController::CreateBitrateController(clock_, event_log)),
+ retransmission_rate_limiter_(
+ new RateLimiter(clock, kMaxRetransmitWindowSizeMs)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
@@ -191,6 +196,8 @@
// construction.
bitrate_controller_(
BitrateController::CreateBitrateController(clock_, event_log)),
+ retransmission_rate_limiter_(
+ new RateLimiter(clock, kMaxRetransmitWindowSizeMs)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
@@ -266,6 +273,10 @@
return &transport_feedback_adapter_;
}
+RateLimiter* CongestionController::GetRetransmissionRateLimiter() {
+ return retransmission_rate_limiter_.get();
+}
+
void CongestionController::SetAllocatedSendBitrateLimits(
int min_send_bitrate_bps,
int max_padding_bitrate_bps) {
@@ -299,6 +310,14 @@
void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
remote_bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms);
transport_feedback_adapter_.OnRttUpdate(avg_rtt_ms, max_rtt_ms);
+
+ int64_t nack_window_size_ms = max_rtt_ms;
+ if (nack_window_size_ms > kMaxRetransmitWindowSizeMs) {
+ nack_window_size_ms = kMaxRetransmitWindowSizeMs;
+ } else if (nack_window_size_ms < kMinRetransmitWindowSizeMs) {
+ nack_window_size_ms = kMinRetransmitWindowSizeMs;
+ }
+ retransmission_rate_limiter_->SetWindowSize(nack_window_size_ms);
}
int64_t CongestionController::TimeUntilNextProcess() {
@@ -323,8 +342,10 @@
int64_t rtt;
bool estimate_changed = bitrate_controller_->GetNetworkParameters(
&bitrate_bps, &fraction_loss, &rtt);
- if (estimate_changed)
+ if (estimate_changed) {
pacer_->SetEstimatedBitrate(bitrate_bps);
+ retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
+ }
bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps;
« no previous file with comments | « webrtc/common_types.h ('k') | webrtc/modules/congestion_controller/include/congestion_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698