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 #include "media/base/test_data_util.h" | 5 #include "media/base/test_data_util.h" |
6 #include "media/test/pipeline_integration_test_base.h" | 6 #include "media/test/pipeline_integration_test_base.h" |
7 #include "testing/perf/perf_test.h" | 7 #include "testing/perf/perf_test.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
11 static const int kBenchmarkIterationsAudio = 200; | 11 static const int kBenchmarkIterationsAudio = 200; |
12 static const int kBenchmarkIterationsVideo = 20; | 12 static const int kBenchmarkIterationsVideo = 20; |
13 | 13 |
14 static void RunPlaybackBenchmark(const std::string& filename, | 14 static void RunPlaybackBenchmark(const std::string& filename, |
15 const std::string& name, | 15 const std::string& name, |
16 int iterations, | 16 int iterations, |
17 bool audio_only) { | 17 bool audio_only) { |
18 double time_seconds = 0.0; | 18 double time_seconds = 0.0; |
19 | 19 |
20 for (int i = 0; i < iterations; ++i) { | 20 for (int i = 0; i < iterations; ++i) { |
21 PipelineIntegrationTestBase pipeline; | 21 PipelineIntegrationTestBase pipeline; |
22 | 22 |
23 ASSERT_EQ( | 23 ASSERT_EQ( |
24 PIPELINE_OK, | 24 PIPELINE_OK, |
25 pipeline.Start(filename, PipelineIntegrationTestBase::kClockless)); | 25 pipeline.Start(filename, PipelineIntegrationTestBase::kClockless)); |
26 | 26 |
27 base::TimeTicks start = base::TimeTicks::HighResNow(); | 27 base::TimeTicks start = base::TimeTicks::Now(); |
28 pipeline.Play(); | 28 pipeline.Play(); |
29 | 29 |
30 ASSERT_TRUE(pipeline.WaitUntilOnEnded()); | 30 ASSERT_TRUE(pipeline.WaitUntilOnEnded()); |
31 | 31 |
32 // Call Stop() to ensure that the rendering is complete. | 32 // Call Stop() to ensure that the rendering is complete. |
33 pipeline.Stop(); | 33 pipeline.Stop(); |
34 | 34 |
35 if (audio_only) { | 35 if (audio_only) { |
36 time_seconds += pipeline.GetAudioTime().InSecondsF(); | 36 time_seconds += pipeline.GetAudioTime().InSecondsF(); |
37 } else { | 37 } else { |
38 time_seconds += (base::TimeTicks::HighResNow() - start).InSecondsF(); | 38 time_seconds += (base::TimeTicks::Now() - start).InSecondsF(); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 perf_test::PrintResult(name, | 42 perf_test::PrintResult(name, |
43 "", | 43 "", |
44 filename, | 44 filename, |
45 iterations / time_seconds, | 45 iterations / time_seconds, |
46 "runs/s", | 46 "runs/s", |
47 true); | 47 true); |
48 } | 48 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 "clockless_video_playback_theora"); | 80 "clockless_video_playback_theora"); |
81 } | 81 } |
82 | 82 |
83 #if defined(USE_PROPRIETARY_CODECS) | 83 #if defined(USE_PROPRIETARY_CODECS) |
84 TEST(PipelineIntegrationPerfTest, MP4PlaybackBenchmark) { | 84 TEST(PipelineIntegrationPerfTest, MP4PlaybackBenchmark) { |
85 RunVideoPlaybackBenchmark("bear_silent.mp4", "clockless_video_playback_mp4"); | 85 RunVideoPlaybackBenchmark("bear_silent.mp4", "clockless_video_playback_mp4"); |
86 } | 86 } |
87 #endif | 87 #endif |
88 | 88 |
89 } // namespace media | 89 } // namespace media |
OLD | NEW |