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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "media/base/audio_converter.h" | 6 #include "media/base/audio_converter.h" |
7 #include "media/base/fake_audio_render_callback.h" | 7 #include "media/base/fake_audio_render_callback.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "testing/perf/perf_test.h" | 9 #include "testing/perf/perf_test.h" |
10 | 10 |
11 namespace media { | 11 namespace media { |
12 | 12 |
13 static const int kBenchmarkIterations = 200000; | 13 static const int kBenchmarkIterations = 200000; |
14 | 14 |
15 // InputCallback that zero's out the provided AudioBus. | 15 // InputCallback that zero's out the provided AudioBus. |
16 class NullInputProvider : public AudioConverter::InputCallback { | 16 class NullInputProvider : public AudioConverter::InputCallback { |
17 public: | 17 public: |
18 NullInputProvider() {} | 18 NullInputProvider() {} |
19 virtual ~NullInputProvider() {} | 19 virtual ~NullInputProvider() {} |
20 | 20 |
21 virtual double ProvideInput(AudioBus* audio_bus, | 21 virtual double ProvideInput(AudioBus* audio_bus, |
22 base::TimeDelta buffer_delay) OVERRIDE { | 22 base::TimeDelta buffer_delay) override { |
23 audio_bus->Zero(); | 23 audio_bus->Zero(); |
24 return 1; | 24 return 1; |
25 } | 25 } |
26 }; | 26 }; |
27 | 27 |
28 void RunConvertBenchmark(const AudioParameters& in_params, | 28 void RunConvertBenchmark(const AudioParameters& in_params, |
29 const AudioParameters& out_params, | 29 const AudioParameters& out_params, |
30 bool fifo, | 30 bool fifo, |
31 const std::string& trace_name) { | 31 const std::string& trace_name) { |
32 NullInputProvider fake_input1; | 32 NullInputProvider fake_input1; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 2048); | 70 2048); |
71 AudioParameters output_params( | 71 AudioParameters output_params( |
72 AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 44100, 16, 440); | 72 AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 44100, 16, 440); |
73 | 73 |
74 RunConvertBenchmark(input_params, output_params, true, "convert_fifo_only"); | 74 RunConvertBenchmark(input_params, output_params, true, "convert_fifo_only"); |
75 RunConvertBenchmark(input_params, output_params, false, | 75 RunConvertBenchmark(input_params, output_params, false, |
76 "convert_pass_through"); | 76 "convert_pass_through"); |
77 } | 77 } |
78 | 78 |
79 } // namespace media | 79 } // namespace media |
OLD | NEW |