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

Unified Diff: media/cast/sender/congestion_control_unittest.cc

Issue 629493004: [Cast] Clean-up: Move max_unacked_frames into CongestionControl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « media/cast/sender/congestion_control.cc ('k') | media/cast/sender/frame_sender.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/congestion_control_unittest.cc
diff --git a/media/cast/sender/congestion_control_unittest.cc b/media/cast/sender/congestion_control_unittest.cc
index ec68c02625290c42791dc70d34200e99fdd37c42..bf76a35c27d654451fbb4ae1ac1fe58e75c402b9 100644
--- a/media/cast/sender/congestion_control_unittest.cc
+++ b/media/cast/sender/congestion_control_unittest.cc
@@ -16,6 +16,8 @@ namespace cast {
static const uint32 kMaxBitrateConfigured = 5000000;
static const uint32 kMinBitrateConfigured = 500000;
+static const int64 kFrameDelayMs = 33;
+static const double kMaxFrameRate = 1000.0 / kFrameDelayMs;
static const int64 kStartMillisecond = INT64_C(12345678900000);
static const double kTargetEmptyBufferFraction = 0.9;
@@ -26,7 +28,13 @@ class CongestionControlTest : public ::testing::Test {
testing_clock_.Advance(
base::TimeDelta::FromMilliseconds(kStartMillisecond));
congestion_control_.reset(NewAdaptiveCongestionControl(
- &testing_clock_, kMaxBitrateConfigured, kMinBitrateConfigured, 10));
+ &testing_clock_, kMaxBitrateConfigured, kMinBitrateConfigured,
+ kMaxFrameRate));
+ const int max_unacked_frames = 10;
+ const base::TimeDelta target_playout_delay =
+ (max_unacked_frames - 1) * base::TimeDelta::FromSeconds(1) /
+ kMaxFrameRate;
+ congestion_control_->UpdateTargetPlayoutDelay(target_playout_delay);
}
void AckFrame(uint32 frame_id) {
@@ -60,17 +68,16 @@ class CongestionControlTest : public ::testing::Test {
};
TEST_F(CongestionControlTest, SimpleRun) {
- uint32 frame_delay = 33;
uint32 frame_size = 10000 * 8;
Run(500,
frame_size,
base::TimeDelta::FromMilliseconds(10),
- base::TimeDelta::FromMilliseconds(frame_delay),
+ base::TimeDelta::FromMilliseconds(kFrameDelayMs),
base::TimeDelta::FromMilliseconds(45));
// Empty the buffer.
task_runner_->Sleep(base::TimeDelta::FromMilliseconds(100));
- uint32 safe_bitrate = frame_size * 1000 / frame_delay;
+ uint32 safe_bitrate = frame_size * 1000 / kFrameDelayMs;
uint32 bitrate = congestion_control_->GetBitrate(
testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300),
base::TimeDelta::FromMilliseconds(300));
« no previous file with comments | « media/cast/sender/congestion_control.cc ('k') | media/cast/sender/frame_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698