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 static const int kCommonRtpHeaderLength = 12; | 36 static const int kCommonRtpHeaderLength = 12; |
39 static const uint8 kCastReferenceFrameIdBitReset = 0xDF; // Mask is 0x40. | 37 static const uint8 kCastReferenceFrameIdBitReset = 0xDF; // Mask is 0x40. |
40 | 38 |
41 // Since the video encoded and decoded an error will be introduced; when | 39 // Since the video encoded and decoded an error will be introduced; when |
42 // comparing individual pixels the error can be quite large; we allow a PSNR of | 40 // comparing individual pixels the error can be quite large; we allow a PSNR of |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 test_receiver_video_callback_->number_times_called()); | 862 test_receiver_video_callback_->number_times_called()); |
865 } | 863 } |
866 | 864 |
867 // TODO(pwestin): Add repeatable packet loss test. | 865 // TODO(pwestin): Add repeatable packet loss test. |
868 // TODO(pwestin): Add test for misaligned send get calls. | 866 // TODO(pwestin): Add test for misaligned send get calls. |
869 // TODO(pwestin): Add more tests that does not resample. | 867 // TODO(pwestin): Add more tests that does not resample. |
870 // TODO(pwestin): Add test when we have starvation for our RunTask. | 868 // TODO(pwestin): Add test when we have starvation for our RunTask. |
871 | 869 |
872 } // namespace cast | 870 } // namespace cast |
873 } // namespace media | 871 } // namespace media |
OLD | NEW |