| Index: media/base/audio_converter_unittest.cc
|
| diff --git a/media/base/audio_converter_unittest.cc b/media/base/audio_converter_unittest.cc
|
| index 0861222e5ef0eebb010479dbebee1e6cd27fe0a2..eb68db6d27c2e29c3a1e95fc118c7da36f41e44d 100644
|
| --- a/media/base/audio_converter_unittest.cc
|
| +++ b/media/base/audio_converter_unittest.cc
|
| @@ -221,41 +221,51 @@ TEST(AudioConverterTest, ConvertBenchmark) {
|
| AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, 48000, 16, 2048);
|
| AudioParameters output_params(
|
| AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 44100, 16, 440);
|
| - scoped_ptr<AudioConverter> converter(
|
| - new AudioConverter(input_params, output_params, false));
|
| -
|
| scoped_ptr<AudioBus> output_bus = AudioBus::Create(output_params);
|
| - FakeAudioRenderCallback fake_input1(0.2);
|
| - FakeAudioRenderCallback fake_input2(0.4);
|
| - FakeAudioRenderCallback fake_input3(0.6);
|
| - converter->AddInput(&fake_input1);
|
| - converter->AddInput(&fake_input2);
|
| - converter->AddInput(&fake_input3);
|
|
|
| printf("Benchmarking %d iterations:\n", benchmark_iterations);
|
|
|
| // Benchmark Convert() w/ FIFO.
|
| - base::TimeTicks start = base::TimeTicks::HighResNow();
|
| - for (int i = 0; i < benchmark_iterations; ++i) {
|
| - converter->Convert(output_bus.get());
|
| + {
|
| + scoped_ptr<AudioConverter> converter(
|
| + new AudioConverter(input_params, output_params, false));
|
| +
|
| + FakeAudioRenderCallback fake_input1(0.2);
|
| + FakeAudioRenderCallback fake_input2(0.4);
|
| + FakeAudioRenderCallback fake_input3(0.6);
|
| + converter->AddInput(&fake_input1);
|
| + converter->AddInput(&fake_input2);
|
| + converter->AddInput(&fake_input3);
|
| +
|
| + base::TimeTicks start = base::TimeTicks::HighResNow();
|
| + for (int i = 0; i < benchmark_iterations; ++i) {
|
| + converter->Convert(output_bus.get());
|
| + }
|
| + double total_time_ms =
|
| + (base::TimeTicks::HighResNow() - start).InMillisecondsF();
|
| + printf("Convert() w/ FIFO took %.2fms.\n", total_time_ms);
|
| }
|
| - double total_time_ms =
|
| - (base::TimeTicks::HighResNow() - start).InMillisecondsF();
|
| - printf("Convert() w/ FIFO took %.2fms.\n", total_time_ms);
|
| -
|
| - converter.reset(new AudioConverter(input_params, output_params, true));
|
| - converter->AddInput(&fake_input1);
|
| - converter->AddInput(&fake_input2);
|
| - converter->AddInput(&fake_input3);
|
| -
|
| - // Benchmark Convert() w/o FIFO.
|
| - start = base::TimeTicks::HighResNow();
|
| - for (int i = 0; i < benchmark_iterations; ++i) {
|
| - converter->Convert(output_bus.get());
|
| +
|
| + {
|
| + scoped_ptr<AudioConverter> converter(
|
| + new AudioConverter(input_params, output_params, true));
|
| +
|
| + FakeAudioRenderCallback fake_input1(0.2);
|
| + FakeAudioRenderCallback fake_input2(0.4);
|
| + FakeAudioRenderCallback fake_input3(0.6);
|
| + converter->AddInput(&fake_input1);
|
| + converter->AddInput(&fake_input2);
|
| + converter->AddInput(&fake_input3);
|
| +
|
| + // Benchmark Convert() w/o FIFO.
|
| + base::TimeTicks start = base::TimeTicks::HighResNow();
|
| + for (int i = 0; i < benchmark_iterations; ++i) {
|
| + converter->Convert(output_bus.get());
|
| + }
|
| + double total_time_ms =
|
| + (base::TimeTicks::HighResNow() - start).InMillisecondsF();
|
| + printf("Convert() w/o FIFO took %.2fms.\n", total_time_ms);
|
| }
|
| - total_time_ms =
|
| - (base::TimeTicks::HighResNow() - start).InMillisecondsF();
|
| - printf("Convert() w/o FIFO took %.2fms.\n", total_time_ms);
|
| }
|
|
|
| TEST_P(AudioConverterTest, NoInputs) {
|
|
|