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

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

Issue 2970653004: Reimplemeted "Test and fix for huge bwe drop after alr state" (Closed)
Patch Set: Response to comments. Created 3 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
Index: webrtc/modules/congestion_controller/bitrate_estimator.cc
diff --git a/webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.cc b/webrtc/modules/congestion_controller/bitrate_estimator.cc
similarity index 75%
rename from webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.cc
rename to webrtc/modules/congestion_controller/bitrate_estimator.cc
index 3fa3ac9995b0cbeb168ff2e6466ef6cdcfe49178..74df6d00e709dce511517ff938c3b87f67292a8b 100644
--- a/webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.cc
+++ b/webrtc/modules/congestion_controller/bitrate_estimator.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.h"
+#include "webrtc/modules/congestion_controller/bitrate_estimator.h"
#include <cmath>
@@ -20,32 +20,18 @@ namespace webrtc {
namespace {
constexpr int kInitialRateWindowMs = 500;
constexpr int kRateWindowMs = 150;
-
-bool IsInSendTimeHistory(const PacketFeedback& packet) {
- return packet.send_time_ms >= 0;
-}
-
} // namespace
-AcknowledgedBitrateEstimator::AcknowledgedBitrateEstimator()
+BitrateEstimator::BitrateEstimator()
: sum_(0),
current_win_ms_(0),
prev_time_ms_(-1),
bitrate_estimate_(-1.0f),
bitrate_estimate_var_(50.0f) {}
-void AcknowledgedBitrateEstimator::IncomingPacketFeedbackVector(
- const std::vector<PacketFeedback>& packet_feedback_vector) {
- RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(),
- packet_feedback_vector.end(),
- PacketFeedbackComparator()));
- for (const auto& packet : packet_feedback_vector) {
- if (IsInSendTimeHistory(packet))
- Update(packet.arrival_time_ms, packet.payload_size);
- }
-}
+BitrateEstimator::~BitrateEstimator() = default;
-void AcknowledgedBitrateEstimator::Update(int64_t now_ms, int bytes) {
+void BitrateEstimator::Update(int64_t now_ms, int bytes) {
int rate_window_ms = kRateWindowMs;
// We use a larger window at the beginning to get a more stable sample that
// we can use to initialize the estimate.
@@ -78,9 +64,9 @@ void AcknowledgedBitrateEstimator::Update(int64_t now_ms, int bytes) {
bitrate_estimate_ * 1000);
}
-float AcknowledgedBitrateEstimator::UpdateWindow(int64_t now_ms,
- int bytes,
- int rate_window_ms) {
+float BitrateEstimator::UpdateWindow(int64_t now_ms,
+ int bytes,
+ int rate_window_ms) {
// Reset if time moves backwards.
if (now_ms < prev_time_ms_) {
prev_time_ms_ = -1;
@@ -106,10 +92,16 @@ float AcknowledgedBitrateEstimator::UpdateWindow(int64_t now_ms,
return bitrate_sample;
}
-rtc::Optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const {
+rtc::Optional<uint32_t> BitrateEstimator::bitrate_bps() const {
if (bitrate_estimate_ < 0.f)
return rtc::Optional<uint32_t>();
return rtc::Optional<uint32_t>(bitrate_estimate_ * 1000);
}
+void BitrateEstimator::ExpectFastRateChange() {
+ // By setting the bitrate-estimate variance to a hight value we allow the
holmer 2017/07/07 07:53:07 higher
tschumi 2017/07/07 09:07:59 Done.
+ // bitrate to change fast for the next few samples.
+ bitrate_estimate_var_ = 200;
terelius 2017/07/07 08:01:19 Why 200 compared to say, 50 or 20? Assuming that 2
holmer 2017/07/07 08:08:00 Good point. Maybe += 200 or similar?
tschumi 2017/07/07 09:07:59 I have no strong verification for 200. I used the
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698