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

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

Issue 560223002: [Cast] Limit frames in flight by duration, and not by number of frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Account for faster input than configured max FPS. Created 6 years, 3 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
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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 StartBasicPlayer(); 1391 StartBasicPlayer();
1392 1392
1393 int frames_counter = 0; 1393 int frames_counter = 0;
1394 for (; frames_counter < 10000; ++frames_counter) { 1394 for (; frames_counter < 10000; ++frames_counter) {
1395 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); 1395 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1396 RunTasks(kFrameTimerMs); 1396 RunTasks(kFrameTimerMs);
1397 } 1397 }
1398 base::TimeTicks test_end = testing_clock_receiver_->NowTicks(); 1398 base::TimeTicks test_end = testing_clock_receiver_->NowTicks();
1399 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. 1399 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline.
1400 EXPECT_GT(video_ticks_.size(), 100ul); 1400 EXPECT_GT(video_ticks_.size(), 100ul);
1401 VLOG(1) << "Fully transmitted " << video_ticks_.size()
1402 << " out of 10000 frames.";
1401 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000); 1403 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000);
1402 } 1404 }
1403 1405
1406 // Tests that a system configured for 30 FPS drops frames when input is provided
1407 // at a much higher frame rate.
1408 TEST_F(End2EndTest, ShoveHighFrameRateDownYerThroat) {
1409 Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16, 32000,
1410 1);
1411 receiver_to_sender_.SetPacketPipe(test::EvilNetwork().Pass());
1412 sender_to_receiver_.SetPacketPipe(test::EvilNetwork().Pass());
1413 Create();
1414 StartBasicPlayer();
1415
1416 int frames_counter = 0;
1417 for (; frames_counter < 10000; ++frames_counter) {
1418 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1419 RunTasks(10 /* 10 ms, but 33.3 expected by system */);
1420 }
1421 base::TimeTicks test_end = testing_clock_receiver_->NowTicks();
1422 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline.
1423 EXPECT_LT(100ul, video_ticks_.size());
1424 EXPECT_GE(3334ul, video_ticks_.size());
1425 VLOG(1) << "Fully transmitted " << video_ticks_.size()
1426 << " out of 10000 frames.";
1427 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000);
1428 }
1429
1404 TEST_F(End2EndTest, OldPacketNetwork) { 1430 TEST_F(End2EndTest, OldPacketNetwork) {
1405 Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16, 32000, 1); 1431 Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16, 32000, 1);
1406 sender_to_receiver_.SetPacketPipe(test::NewRandomDrop(0.01)); 1432 sender_to_receiver_.SetPacketPipe(test::NewRandomDrop(0.01));
1407 scoped_ptr<test::PacketPipe> echo_chamber( 1433 scoped_ptr<test::PacketPipe> echo_chamber(
1408 test::NewDuplicateAndDelay(1, 10 * kFrameTimerMs)); 1434 test::NewDuplicateAndDelay(1, 10 * kFrameTimerMs));
1409 echo_chamber->AppendToPipe( 1435 echo_chamber->AppendToPipe(
1410 test::NewDuplicateAndDelay(1, 20 * kFrameTimerMs)); 1436 test::NewDuplicateAndDelay(1, 20 * kFrameTimerMs));
1411 echo_chamber->AppendToPipe( 1437 echo_chamber->AppendToPipe(
1412 test::NewDuplicateAndDelay(1, 40 * kFrameTimerMs)); 1438 test::NewDuplicateAndDelay(1, 40 * kFrameTimerMs));
1413 echo_chamber->AppendToPipe( 1439 echo_chamber->AppendToPipe(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 EXPECT_LT(jump, 220u); 1492 EXPECT_LT(jump, 220u);
1467 } 1493 }
1468 1494
1469 // TODO(pwestin): Add repeatable packet loss test. 1495 // TODO(pwestin): Add repeatable packet loss test.
1470 // TODO(pwestin): Add test for misaligned send get calls. 1496 // TODO(pwestin): Add test for misaligned send get calls.
1471 // TODO(pwestin): Add more tests that does not resample. 1497 // TODO(pwestin): Add more tests that does not resample.
1472 // TODO(pwestin): Add test when we have starvation for our RunTask. 1498 // TODO(pwestin): Add test when we have starvation for our RunTask.
1473 1499
1474 } // namespace cast 1500 } // namespace cast
1475 } // namespace media 1501 } // namespace media
OLDNEW
« media/cast/sender/video_sender.cc ('K') | « media/cast/sender/video_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698