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 |
11 | 11 |
12 #include <math.h> | 12 #include <math.h> |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 | 15 |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/test/simple_test_tick_clock.h" | 17 #include "base/test/simple_test_tick_clock.h" |
18 #include "base/time/tick_clock.h" | 18 #include "base/time/tick_clock.h" |
19 #include "media/cast/cast_config.h" | 19 #include "media/cast/cast_config.h" |
20 #include "media/cast/cast_environment.h" | 20 #include "media/cast/cast_environment.h" |
21 #include "media/cast/cast_receiver.h" | 21 #include "media/cast/cast_receiver.h" |
22 #include "media/cast/cast_sender.h" | 22 #include "media/cast/cast_sender.h" |
23 #include "media/cast/test/fake_task_runner.h" | 23 #include "media/cast/test/fake_task_runner.h" |
24 #include "media/cast/test/video_utility.h" | 24 #include "media/cast/test/video_utility.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 namespace media { | 27 namespace media { |
28 namespace cast { | 28 namespace cast { |
29 | 29 |
30 // Since our time is based on year 1600 and NTP is based on year 1900 we must | 30 static const int64 kStartMillisecond = GG_INT64_C(1245); |
31 // initialize our fake clock to at least 300 year passed year 1600. | |
32 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); | |
33 static const int kAudioChannels = 2; | 31 static const int kAudioChannels = 2; |
34 static const int kAudioSamplingFrequency = 48000; | 32 static const int kAudioSamplingFrequency = 48000; |
35 static const int kSoundFrequency = 1234; // Frequency of sinusoid wave. | 33 static const int kSoundFrequency = 1234; // Frequency of sinusoid wave. |
36 static const int kVideoWidth = 1280; | 34 static const int kVideoWidth = 1280; |
37 static const int kVideoHeight = 720; | 35 static const int kVideoHeight = 720; |
38 | 36 |
39 // Since the video encoded and decoded an error will be introduced; when | 37 // Since the video encoded and decoded an error will be introduced; when |
40 // comparing individual pixels the error can be quite large; we allow a PSNR of | 38 // comparing individual pixels the error can be quite large; we allow a PSNR of |
41 // at least |kVideoAcceptedPSNR|. | 39 // at least |kVideoAcceptedPSNR|. |
42 static const double kVideoAcceptedPSNR = 38.0; | 40 static const double kVideoAcceptedPSNR = 38.0; |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 EXPECT_EQ(i / 2, test_receiver_video_callback_->number_times_called()); | 823 EXPECT_EQ(i / 2, test_receiver_video_callback_->number_times_called()); |
826 } | 824 } |
827 | 825 |
828 // TODO(pwestin): Add repeatable packet loss test. | 826 // TODO(pwestin): Add repeatable packet loss test. |
829 // TODO(pwestin): Add test for misaligned send get calls. | 827 // TODO(pwestin): Add test for misaligned send get calls. |
830 // TODO(pwestin): Add more tests that does not resample. | 828 // TODO(pwestin): Add more tests that does not resample. |
831 // TODO(pwestin): Add test when we have starvation for our RunTask. | 829 // TODO(pwestin): Add test when we have starvation for our RunTask. |
832 | 830 |
833 } // namespace cast | 831 } // namespace cast |
834 } // namespace media | 832 } // namespace media |
OLD | NEW |