OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/synchronization/condition_variable.h" | 7 #include "base/synchronization/condition_variable.h" |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 : codec(c), num_channels(n), sampling_rate(s) {} | 28 : codec(c), num_channels(n), sampling_rate(s) {} |
29 }; | 29 }; |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> { | 32 class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> { |
33 public: | 33 public: |
34 AudioDecoderTest() | 34 AudioDecoderTest() |
35 : cast_environment_(new StandaloneCastEnvironment()), | 35 : cast_environment_(new StandaloneCastEnvironment()), |
36 cond_(&lock_) {} | 36 cond_(&lock_) {} |
37 | 37 |
| 38 virtual ~AudioDecoderTest() { |
| 39 // Make sure all threads have stopped before the environment goes away. |
| 40 cast_environment_->Shutdown(); |
| 41 } |
| 42 |
38 protected: | 43 protected: |
39 virtual void SetUp() OVERRIDE { | 44 virtual void SetUp() OVERRIDE { |
40 audio_decoder_.reset(new AudioDecoder(cast_environment_, | 45 audio_decoder_.reset(new AudioDecoder(cast_environment_, |
41 GetParam().num_channels, | 46 GetParam().num_channels, |
42 GetParam().sampling_rate, | 47 GetParam().sampling_rate, |
43 GetParam().codec)); | 48 GetParam().codec)); |
44 CHECK_EQ(STATUS_AUDIO_INITIALIZED, audio_decoder_->InitializationResult()); | 49 CHECK_EQ(STATUS_AUDIO_INITIALIZED, audio_decoder_->InitializationResult()); |
45 | 50 |
46 audio_bus_factory_.reset( | 51 audio_bus_factory_.reset( |
47 new TestAudioBusFactory(GetParam().num_channels, | 52 new TestAudioBusFactory(GetParam().num_channels, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 AudioDecoderTestScenarios, | 238 AudioDecoderTestScenarios, |
234 AudioDecoderTest, | 239 AudioDecoderTest, |
235 ::testing::Values( | 240 ::testing::Values( |
236 TestScenario(CODEC_AUDIO_PCM16, 1, 8000), | 241 TestScenario(CODEC_AUDIO_PCM16, 1, 8000), |
237 TestScenario(CODEC_AUDIO_PCM16, 2, 48000), | 242 TestScenario(CODEC_AUDIO_PCM16, 2, 48000), |
238 TestScenario(CODEC_AUDIO_OPUS, 1, 8000), | 243 TestScenario(CODEC_AUDIO_OPUS, 1, 8000), |
239 TestScenario(CODEC_AUDIO_OPUS, 2, 48000))); | 244 TestScenario(CODEC_AUDIO_OPUS, 2, 48000))); |
240 | 245 |
241 } // namespace cast | 246 } // namespace cast |
242 } // namespace media | 247 } // namespace media |
OLD | NEW |