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 70% |
rename from webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.cc |
rename to webrtc/modules/congestion_controller/bitrate_estimator.cc |
index 9df378c64b8f24165703eb738e5078b6b7db5fb3..c9960dc2ddd2b8d3994d605875a8409a43224746 100644 |
--- a/webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.cc |
+++ b/webrtc/modules/congestion_controller/bitrate_estimator.cc |
@@ -8,43 +8,27 @@ |
* 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> |
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
- |
namespace webrtc { |
namespace { |
-constexpr int kInitialRateWindowMs = 500; |
-constexpr int kRateWindowMs = 150; |
- |
-bool IsInSendTimeHistory(const PacketFeedback& packet) { |
- return packet.send_time_ms >= 0; |
-} |
- |
+constexpr int kInitialRateWindowMs = 50; |
+constexpr int kRateWindowMs = 50; |
} // 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. |
@@ -75,9 +59,9 @@ void AcknowledgedBitrateEstimator::Update(int64_t now_ms, int bytes) { |
(sample_var + pred_bitrate_estimate_var); |
} |
-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; |
@@ -103,7 +87,7 @@ 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); |