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