OLD | NEW |
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 Loading... |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 EXPECT_LT(jump, 220u); | 1498 EXPECT_LT(jump, 220u); |
1473 } | 1499 } |
1474 | 1500 |
1475 // TODO(pwestin): Add repeatable packet loss test. | 1501 // TODO(pwestin): Add repeatable packet loss test. |
1476 // TODO(pwestin): Add test for misaligned send get calls. | 1502 // TODO(pwestin): Add test for misaligned send get calls. |
1477 // TODO(pwestin): Add more tests that does not resample. | 1503 // TODO(pwestin): Add more tests that does not resample. |
1478 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1504 // TODO(pwestin): Add test when we have starvation for our RunTask. |
1479 | 1505 |
1480 } // namespace cast | 1506 } // namespace cast |
1481 } // namespace media | 1507 } // namespace media |
OLD | NEW |