| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "media/base/audio_bus.h" | 9 #include "media/base/audio_bus.h" |
| 10 #include "media/base/fake_audio_render_callback.h" | 10 #include "media/base/fake_audio_render_callback.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 (base::TimeTicks::Now() - start).InMillisecondsF(); | 39 (base::TimeTicks::Now() - start).InMillisecondsF(); |
| 40 perf_test::PrintResult( | 40 perf_test::PrintResult( |
| 41 "audio_bus_from_interleaved", "", trace_name, | 41 "audio_bus_from_interleaved", "", trace_name, |
| 42 total_time_milliseconds / kBenchmarkIterations, "ms", true); | 42 total_time_milliseconds / kBenchmarkIterations, "ms", true); |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Benchmark the FromInterleaved() and ToInterleaved() methods. | 45 // Benchmark the FromInterleaved() and ToInterleaved() methods. |
| 46 TEST(AudioBusPerfTest, Interleave) { | 46 TEST(AudioBusPerfTest, Interleave) { |
| 47 std::unique_ptr<AudioBus> bus = AudioBus::Create(2, 48000 * 120); | 47 std::unique_ptr<AudioBus> bus = AudioBus::Create(2, 48000 * 120); |
| 48 FakeAudioRenderCallback callback(0.2); | 48 FakeAudioRenderCallback callback(0.2); |
| 49 callback.Render(bus.get(), 0, 0); | 49 callback.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, bus.get()); |
| 50 | 50 |
| 51 RunInterleaveBench<int8_t>(bus.get(), "int8_t"); | 51 RunInterleaveBench<int8_t>(bus.get(), "int8_t"); |
| 52 RunInterleaveBench<int16_t>(bus.get(), "int16_t"); | 52 RunInterleaveBench<int16_t>(bus.get(), "int16_t"); |
| 53 RunInterleaveBench<int32_t>(bus.get(), "int32_t"); | 53 RunInterleaveBench<int32_t>(bus.get(), "int32_t"); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace media | 56 } // namespace media |
| OLD | NEW |