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

Unified Diff: webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.cc

Issue 2380883003: Add interval estimator to remote bitrate estimator (Closed)
Patch Set: Simplify probing estimator. Created 4 years, 2 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
Index: webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.cc b/webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..76fda6d2373bb124af96df739efcb250c0a4217b
--- /dev/null
+++ b/webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.cc
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/remote_bitrate_estimator/probing_interval_estimator.h"
+
+#include <algorithm>
+#include <utility>
+
+namespace webrtc {
+
+namespace {
+constexpr int kMinIntervalMs = 2000;
+constexpr int kMaxIntervalMs = 50000;
+}
+
+ProbingIntervalEstimator::ProbingIntervalEstimator(
+ const AimdRateControl* const aimd_rate_control)
+ : ProbingIntervalEstimator(kMinIntervalMs,
+ kMaxIntervalMs,
+ aimd_rate_control) {}
+
+ProbingIntervalEstimator::ProbingIntervalEstimator(
+ int min_interval_ms,
+ int max_interval_ms,
+ const AimdRateControl* const aimd_rate_control)
+ : min_interval_ms_(min_interval_ms),
+ max_interval_ms_(max_interval_ms),
+ aimd_rate_control_(aimd_rate_control) {}
+
+rtc::Optional<int> ProbingIntervalEstimator::GetIntervalMs() const {
+ auto drop_hight = aimd_rate_control_->GetLastDecrease();
stefan-webrtc 2016/10/26 14:30:06 drop_height I would also prefer not using auto fo
+ auto increase_rate = aimd_rate_control_->GetNearMaxIncreaseRate();
+ if (drop_hight && increase_rate && *increase_rate > 0) {
+ return rtc::Optional<int>(std::min(
+ max_interval_ms_,
+ std::max(1000 * (*drop_hight) / (*increase_rate), min_interval_ms_)));
+ }
+ return rtc::Optional<int>();
stefan-webrtc 2016/10/26 14:30:06 Have the "expected path" return here instead. so
+}
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698