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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 for (; frames_counter < 10000; ++frames_counter) { | 1447 for (; frames_counter < 10000; ++frames_counter) { |
1448 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); | 1448 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); |
1449 RunTasks(kFrameTimerMs); | 1449 RunTasks(kFrameTimerMs); |
1450 } | 1450 } |
1451 base::TimeTicks test_end = testing_clock_receiver_->NowTicks(); | 1451 base::TimeTicks test_end = testing_clock_receiver_->NowTicks(); |
1452 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. | 1452 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. |
1453 EXPECT_GT(video_ticks_.size(), 100ul); | 1453 EXPECT_GT(video_ticks_.size(), 100ul); |
1454 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000); | 1454 EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000); |
1455 } | 1455 } |
1456 | 1456 |
| 1457 TEST_F(End2EndTest, OldPacketNetwork) { |
| 1458 Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16, 32000, 1); |
| 1459 sender_to_receiver_.SetPacketPipe(test::NewRandomDrop(0.01)); |
| 1460 scoped_ptr<test::PacketPipe> echo_chamber( |
| 1461 test::NewDuplicateAndDelay(1, 10 * kFrameTimerMs)); |
| 1462 echo_chamber->AppendToPipe( |
| 1463 test::NewDuplicateAndDelay(1, 20 * kFrameTimerMs)); |
| 1464 echo_chamber->AppendToPipe( |
| 1465 test::NewDuplicateAndDelay(1, 40 * kFrameTimerMs)); |
| 1466 echo_chamber->AppendToPipe( |
| 1467 test::NewDuplicateAndDelay(1, 80 * kFrameTimerMs)); |
| 1468 echo_chamber->AppendToPipe( |
| 1469 test::NewDuplicateAndDelay(1, 160 * kFrameTimerMs)); |
| 1470 |
| 1471 receiver_to_sender_.SetPacketPipe(echo_chamber.Pass()); |
| 1472 Create(); |
| 1473 StartBasicPlayer(); |
| 1474 |
| 1475 SetExpectedVideoPlayoutSmoothness( |
| 1476 base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 90 / 100, |
| 1477 base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 110 / 100, |
| 1478 base::TimeDelta::FromMilliseconds(kFrameTimerMs) / 10); |
| 1479 |
| 1480 int frames_counter = 0; |
| 1481 for (; frames_counter < 10000; ++frames_counter) { |
| 1482 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); |
| 1483 RunTasks(kFrameTimerMs); |
| 1484 } |
| 1485 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. |
| 1486 |
| 1487 EXPECT_EQ(10000ul, video_ticks_.size()); |
| 1488 } |
| 1489 |
1457 // TODO(pwestin): Add repeatable packet loss test. | 1490 // TODO(pwestin): Add repeatable packet loss test. |
1458 // TODO(pwestin): Add test for misaligned send get calls. | 1491 // TODO(pwestin): Add test for misaligned send get calls. |
1459 // TODO(pwestin): Add more tests that does not resample. | 1492 // TODO(pwestin): Add more tests that does not resample. |
1460 // TODO(pwestin): Add test when we have starvation for our RunTask. | 1493 // TODO(pwestin): Add test when we have starvation for our RunTask. |
1461 | 1494 |
1462 } // namespace cast | 1495 } // namespace cast |
1463 } // namespace media | 1496 } // namespace media |
OLD | NEW |