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

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

Issue 2537043003: fix wrong implementation of AimdRateControl::TimeToReduceFurther. (Closed)
Patch Set: fix wrong implementation of AimdRateControl::TimeToReduceFurther Created 4 years 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/remote_bitrate_estimator/aimd_rate_control.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc
index b36b16ddbf1d137d025e2a8a1886a950399ef753..2bb4bf68c59ad6f4a6fae933c0b49cbc33e7df0b 100644
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc
@@ -89,4 +89,36 @@ TEST(AimdRateControlTest, GetLastBitrateDecrease) {
states.aimd_rate_control->GetLastBitrateDecreaseBps());
}
+TEST(AimdRateControlTest, OneRTTWithoutBitrateChangeWhenOverUsing) {
+ auto states = CreateAimdRateControlStates();
+ constexpr int kBitrate = 300000;
+ constexpr int64_t kRtt = 150;
+ InitBitrate(states, kBitrate, states.simulated_clock->TimeInMilliseconds());
+ UpdateRateControl(states, kBwOverusing, kBitrate - 2000,
+ states.simulated_clock->TimeInMilliseconds());
+ states.aimd_rate_control->SetRtt(kRtt);
+ EXPECT_FALSE(states.aimd_rate_control->TimeToReduceFurther(
+ states.simulated_clock->TimeInMilliseconds(), kBitrate));
+ states.simulated_clock->AdvanceTimeMilliseconds(kRtt);
+ EXPECT_TRUE(states.aimd_rate_control->TimeToReduceFurther(
+ states.simulated_clock->TimeInMilliseconds(), kBitrate));
+}
+
+TEST(AimdRateControlTest, EstimatedAlreadyAchievedWhenOverUsing) {
+ auto states = CreateAimdRateControlStates();
+ constexpr int kBitrate = 300000;
+ constexpr int64_t kRtt = 150;
+ uint32_t bitrate;
+ InitBitrate(states, kBitrate, states.simulated_clock->TimeInMilliseconds());
+ UpdateRateControl(states, kBwOverusing, kBitrate - 2000,
+ states.simulated_clock->TimeInMilliseconds());
+ states.aimd_rate_control->SetRtt(kRtt);
+ bitrate = states.aimd_rate_control->LatestEstimate();
+ EXPECT_FALSE(states.aimd_rate_control->TimeToReduceFurther(
+ states.simulated_clock->TimeInMilliseconds(), bitrate));
+ bitrate = static_cast<uint32_t>(0.95 * bitrate);
+ EXPECT_TRUE(states.aimd_rate_control->TimeToReduceFurther(
+ states.simulated_clock->TimeInMilliseconds(), bitrate));
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698