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

Side by Side Diff: media/cast/test/end2end_unittest.cc

Issue 289283014: Cast: Fake software video encoder to respect target bitrate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: smaller number of iterations Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/cast/video_sender/fake_software_video_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This test generate synthetic data. For audio it's a sinusoid waveform with 5 // This test generate synthetic data. For audio it's a sinusoid waveform with
6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern 6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern
7 // that is shifting by one pixel per frame, each pixels neighbors right and down 7 // that is shifting by one pixel per frame, each pixels neighbors right and down
8 // is this pixels value +1, since the pixel value is 8 bit it will wrap 8 // is this pixels value +1, since the pixel value is 8 bit it will wrap
9 // frequently within the image. Visually this will create diagonally color bands 9 // frequently within the image. Visually this will create diagonally color bands
10 // that moves across the screen 10 // that moves across the screen
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 EXPECT_EQ(1000ul, video_ticks_.size()); 1301 EXPECT_EQ(1000ul, video_ticks_.size());
1302 } 1302 }
1303 1303
1304 TEST_F(End2EndTest, ReceiverClockFast) { 1304 TEST_F(End2EndTest, ReceiverClockFast) {
1305 Configure(transport::kFakeSoftwareVideo, transport::kPcm16, 32000, false, 1); 1305 Configure(transport::kFakeSoftwareVideo, transport::kPcm16, 32000, false, 1);
1306 Create(); 1306 Create();
1307 StartBasicPlayer(); 1307 StartBasicPlayer();
1308 SetReceiverSkew(2.0, base::TimeDelta()); 1308 SetReceiverSkew(2.0, base::TimeDelta());
1309 1309
1310 int frames_counter = 0; 1310 int frames_counter = 0;
1311 for (; frames_counter < 10000; ++frames_counter) { 1311 for (; frames_counter < 1000; ++frames_counter) {
hubbe 2014/05/21 23:07:01 Can we set these to a very low bitrate instead of
1312 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); 1312 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1313 RunTasks(kFrameTimerMs); 1313 RunTasks(kFrameTimerMs);
1314 } 1314 }
1315 RunTasks(2 * kFrameTimerMs + 1); // Empty the pipeline. 1315 RunTasks(2 * kFrameTimerMs + 1); // Empty the pipeline.
1316 EXPECT_EQ(10000ul, video_ticks_.size()); 1316 EXPECT_EQ(1000ul, video_ticks_.size());
1317 } 1317 }
1318 1318
1319 TEST_F(End2EndTest, ReceiverClockSlow) { 1319 TEST_F(End2EndTest, ReceiverClockSlow) {
1320 Configure(transport::kFakeSoftwareVideo, transport::kPcm16, 32000, false, 1); 1320 Configure(transport::kFakeSoftwareVideo, transport::kPcm16, 32000, false, 1);
1321 Create(); 1321 Create();
1322 StartBasicPlayer(); 1322 StartBasicPlayer();
1323 SetReceiverSkew(0.5, base::TimeDelta()); 1323 SetReceiverSkew(0.5, base::TimeDelta());
1324 1324
1325 int frames_counter = 0; 1325 int frames_counter = 0;
1326 for (; frames_counter < 10000; ++frames_counter) { 1326 for (; frames_counter < 1000; ++frames_counter) {
1327 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); 1327 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1328 RunTasks(kFrameTimerMs); 1328 RunTasks(kFrameTimerMs);
1329 } 1329 }
1330 RunTasks(2 * kFrameTimerMs + 1); // Empty the pipeline. 1330 RunTasks(2 * kFrameTimerMs + 1); // Empty the pipeline.
1331 EXPECT_EQ(10000ul, video_ticks_.size()); 1331 EXPECT_EQ(1000ul, video_ticks_.size());
1332 } 1332 }
1333 1333
1334 TEST_F(End2EndTest, EvilNetwork) { 1334 TEST_F(End2EndTest, EvilNetwork) {
1335 Configure(transport::kFakeSoftwareVideo, transport::kPcm16, 32000, false, 1); 1335 Configure(transport::kFakeSoftwareVideo, transport::kPcm16, 32000, false, 1);
1336 receiver_to_sender_.SetPacketPipe(test::EvilNetwork().Pass()); 1336 receiver_to_sender_.SetPacketPipe(test::EvilNetwork().Pass());
1337 sender_to_receiver_.SetPacketPipe(test::EvilNetwork().Pass()); 1337 sender_to_receiver_.SetPacketPipe(test::EvilNetwork().Pass());
1338 Create(); 1338 Create();
1339 StartBasicPlayer(); 1339 StartBasicPlayer();
1340 1340
1341 int frames_counter = 0; 1341 int frames_counter = 0;
1342 for (; frames_counter < 10000; ++frames_counter) { 1342 for (; frames_counter < 1000; ++frames_counter) {
1343 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); 1343 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1344 RunTasks(kFrameTimerMs); 1344 RunTasks(kFrameTimerMs);
1345 } 1345 }
1346 base::TimeTicks test_end = testing_clock_receiver_->NowTicks(); 1346 base::TimeTicks test_end = testing_clock_receiver_->NowTicks();
1347 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. 1347 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline.
1348 EXPECT_GT(video_ticks_.size(), 100ul); 1348 EXPECT_GT(video_ticks_.size(), 100ul);
1349 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000); 1349 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000);
1350 } 1350 }
1351 1351
1352 // TODO(pwestin): Add repeatable packet loss test. 1352 // TODO(pwestin): Add repeatable packet loss test.
1353 // TODO(pwestin): Add test for misaligned send get calls. 1353 // TODO(pwestin): Add test for misaligned send get calls.
1354 // TODO(pwestin): Add more tests that does not resample. 1354 // TODO(pwestin): Add more tests that does not resample.
1355 // TODO(pwestin): Add test when we have starvation for our RunTask. 1355 // TODO(pwestin): Add test when we have starvation for our RunTask.
1356 1356
1357 } // namespace cast 1357 } // namespace cast
1358 } // namespace media 1358 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/cast/video_sender/fake_software_video_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698