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

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

Issue 493823002: Implement adaptive target delay extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: explicit masking Created 6 years, 4 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
« no previous file with comments | « media/cast/sender/video_sender.cc ('k') | no next file » | 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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 int frames_counter = 0; 1487 int frames_counter = 0;
1488 for (; frames_counter < 10000; ++frames_counter) { 1488 for (; frames_counter < 10000; ++frames_counter) {
1489 SendFakeVideoFrame(testing_clock_sender_->NowTicks()); 1489 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1490 RunTasks(kFrameTimerMs); 1490 RunTasks(kFrameTimerMs);
1491 } 1491 }
1492 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. 1492 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline.
1493 1493
1494 EXPECT_EQ(10000ul, video_ticks_.size()); 1494 EXPECT_EQ(10000ul, video_ticks_.size());
1495 } 1495 }
1496 1496
1497 TEST_F(End2EndTest, TestSetPlayoutDelay) {
1498 Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16, 32000, 1);
1499 Create();
1500 StartBasicPlayer();
1501 const int kNewDelay = 600;
1502
1503 int frames_counter = 0;
1504 for (; frames_counter < 200; ++frames_counter) {
1505 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1506 RunTasks(kFrameTimerMs);
1507 }
1508 cast_sender_->SetTargetPlayoutDelay(
1509 base::TimeDelta::FromMilliseconds(kNewDelay));
1510 for (; frames_counter < 400; ++frames_counter) {
1511 SendFakeVideoFrame(testing_clock_sender_->NowTicks());
1512 RunTasks(kFrameTimerMs);
1513 }
1514 RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline.
1515 size_t jump = 0;
1516 for (size_t i = 1; i < video_ticks_.size(); i++) {
1517 int64 delta = (video_ticks_[i].second -
1518 video_ticks_[i-1].second).InMilliseconds();
1519 if (delta > 100) {
1520 EXPECT_EQ(delta, kNewDelay - kTargetPlayoutDelayMs + kFrameTimerMs);
1521 EXPECT_EQ(0u, jump);
1522 jump = i;
1523 }
1524 }
1525 EXPECT_GT(jump, 199u);
1526 EXPECT_LT(jump, 220u);
1527 }
1528
1497 // TODO(pwestin): Add repeatable packet loss test. 1529 // TODO(pwestin): Add repeatable packet loss test.
1498 // TODO(pwestin): Add test for misaligned send get calls. 1530 // TODO(pwestin): Add test for misaligned send get calls.
1499 // TODO(pwestin): Add more tests that does not resample. 1531 // TODO(pwestin): Add more tests that does not resample.
1500 // TODO(pwestin): Add test when we have starvation for our RunTask. 1532 // TODO(pwestin): Add test when we have starvation for our RunTask.
1501 1533
1502 } // namespace cast 1534 } // namespace cast
1503 } // namespace media 1535 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/video_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698