OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
| 8 #include "media/base/audio_renderer_mixer.h" |
| 9 |
8 #include <stddef.h> | 10 #include <stddef.h> |
9 | 11 |
10 #include <cmath> | 12 #include <cmath> |
| 13 #include <memory> |
11 | 14 |
12 #include "base/bind.h" | 15 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
14 #include "base/macros.h" | 17 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
17 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
18 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
19 #include "media/base/audio_renderer_mixer.h" | |
20 #include "media/base/audio_renderer_mixer_input.h" | 21 #include "media/base/audio_renderer_mixer_input.h" |
21 #include "media/base/fake_audio_render_callback.h" | 22 #include "media/base/fake_audio_render_callback.h" |
22 #include "media/base/mock_audio_renderer_sink.h" | 23 #include "media/base/mock_audio_renderer_sink.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 | 28 |
28 // Parameters which control the many input case tests. | 29 // Parameters which control the many input case tests. |
29 const int kMixerInputs = 8; | 30 const int kMixerInputs = 8; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 std::max(1.f, static_cast<float>(floor(mixer_inputs_.size() / 2.f))))); | 326 std::max(1.f, static_cast<float>(floor(mixer_inputs_.size() / 2.f))))); |
326 | 327 |
327 for (size_t i = 1; i < mixer_inputs_.size(); i += 2) | 328 for (size_t i = 1; i < mixer_inputs_.size(); i += 2) |
328 mixer_inputs_[i]->Stop(); | 329 mixer_inputs_[i]->Stop(); |
329 } | 330 } |
330 | 331 |
331 protected: | 332 protected: |
332 virtual ~AudioRendererMixerTest() {} | 333 virtual ~AudioRendererMixerTest() {} |
333 | 334 |
334 scoped_refptr<MockAudioRendererSink> sink_; | 335 scoped_refptr<MockAudioRendererSink> sink_; |
335 scoped_ptr<AudioRendererMixer> mixer_; | 336 std::unique_ptr<AudioRendererMixer> mixer_; |
336 AudioRendererSink::RenderCallback* mixer_callback_; | 337 AudioRendererSink::RenderCallback* mixer_callback_; |
337 std::vector<AudioParameters> input_parameters_; | 338 std::vector<AudioParameters> input_parameters_; |
338 AudioParameters output_parameters_; | 339 AudioParameters output_parameters_; |
339 scoped_ptr<AudioBus> audio_bus_; | 340 std::unique_ptr<AudioBus> audio_bus_; |
340 scoped_ptr<AudioBus> expected_audio_bus_; | 341 std::unique_ptr<AudioBus> expected_audio_bus_; |
341 std::vector< scoped_refptr<AudioRendererMixerInput> > mixer_inputs_; | 342 std::vector< scoped_refptr<AudioRendererMixerInput> > mixer_inputs_; |
342 ScopedVector<FakeAudioRenderCallback> fake_callbacks_; | 343 ScopedVector<FakeAudioRenderCallback> fake_callbacks_; |
343 scoped_ptr<FakeAudioRenderCallback> expected_callback_; | 344 std::unique_ptr<FakeAudioRenderCallback> expected_callback_; |
344 double epsilon_; | 345 double epsilon_; |
345 bool half_fill_; | 346 bool half_fill_; |
346 | 347 |
347 private: | 348 private: |
348 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerTest); | 349 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerTest); |
349 }; | 350 }; |
350 | 351 |
351 class AudioRendererMixerBehavioralTest : public AudioRendererMixerTest {}; | 352 class AudioRendererMixerBehavioralTest : public AudioRendererMixerTest {}; |
352 | 353 |
353 ACTION_P(SignalEvent, event) { | 354 ACTION_P(SignalEvent, event) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 INSTANTIATE_TEST_CASE_P( | 551 INSTANTIATE_TEST_CASE_P( |
551 AudioRendererMixerBehavioralTest, | 552 AudioRendererMixerBehavioralTest, |
552 AudioRendererMixerBehavioralTest, | 553 AudioRendererMixerBehavioralTest, |
553 testing::ValuesIn(std::vector<AudioRendererMixerTestData>( | 554 testing::ValuesIn(std::vector<AudioRendererMixerTestData>( |
554 1, | 555 1, |
555 std::tr1::make_tuple(&kTestInputLower, | 556 std::tr1::make_tuple(&kTestInputLower, |
556 1, | 557 1, |
557 kTestInputLower, | 558 kTestInputLower, |
558 0.00000048)))); | 559 0.00000048)))); |
559 } // namespace media | 560 } // namespace media |
OLD | NEW |