OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "media/engine/apm_helpers.h" | 11 #include "media/engine/apm_helpers.h" |
12 | 12 |
13 #include "media/engine/webrtcvoe.h" | 13 #include "media/engine/webrtcvoe.h" |
14 #include "modules/audio_device/include/mock_audio_device.h" | 14 #include "modules/audio_device/include/mock_audio_device.h" |
15 #include "modules/audio_processing/include/audio_processing.h" | 15 #include "modules/audio_processing/include/audio_processing.h" |
16 #include "test/gmock.h" | 16 #include "test/gmock.h" |
17 #include "test/gtest.h" | 17 #include "test/gtest.h" |
18 #include "test/mock_audio_decoder_factory.h" | 18 #include "test/mock_audio_decoder_factory.h" |
19 #include "voice_engine/transmit_mixer.h" | 19 #include "voice_engine/transmit_mixer.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 namespace { | 22 namespace { |
23 | 23 |
24 constexpr AgcConfig kDefaultAgcConfig = { 3, 9, true }; | 24 constexpr AgcConfig kDefaultAgcConfig = { 3, 9, true }; |
25 | 25 |
26 struct TestHelper { | 26 struct TestHelper { |
27 TestHelper() { | 27 TestHelper() { |
28 // Reply with a 10ms timer every time TimeUntilNextProcess is called to | |
29 // avoid entering a tight loop on the process thread. | |
30 EXPECT_CALL(mock_audio_device_, TimeUntilNextProcess()) | |
31 .WillRepeatedly(testing::Return(10)); | |
32 | |
33 // This replicates the conditions from voe_auto_test. | 28 // This replicates the conditions from voe_auto_test. |
34 Config config; | 29 Config config; |
35 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); | 30 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
36 apm_ = rtc::scoped_refptr<AudioProcessing>(AudioProcessing::Create(config)); | 31 apm_ = rtc::scoped_refptr<AudioProcessing>(AudioProcessing::Create(config)); |
37 EXPECT_EQ(0, voe_wrapper_.base()->Init( | 32 EXPECT_EQ(0, voe_wrapper_.base()->Init( |
38 &mock_audio_device_, apm_, | 33 &mock_audio_device_, apm_, |
39 MockAudioDecoderFactory::CreateEmptyFactory())); | 34 MockAudioDecoderFactory::CreateEmptyFactory())); |
40 } | 35 } |
41 | 36 |
42 AudioProcessing* apm() { return apm_.get(); } | 37 AudioProcessing* apm() { return apm_.get(); } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // TODO(solenberg): Move this test to a better place - added here for the sake | 277 // TODO(solenberg): Move this test to a better place - added here for the sake |
283 // of duplicating all relevant tests from audio_processing_test.cc. | 278 // of duplicating all relevant tests from audio_processing_test.cc. |
284 TEST(ApmHelpersTest, StereoSwapping_EnableDisable) { | 279 TEST(ApmHelpersTest, StereoSwapping_EnableDisable) { |
285 TestHelper helper; | 280 TestHelper helper; |
286 helper.transmit_mixer()->EnableStereoChannelSwapping(true); | 281 helper.transmit_mixer()->EnableStereoChannelSwapping(true); |
287 EXPECT_TRUE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); | 282 EXPECT_TRUE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); |
288 helper.transmit_mixer()->EnableStereoChannelSwapping(false); | 283 helper.transmit_mixer()->EnableStereoChannelSwapping(false); |
289 EXPECT_FALSE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); | 284 EXPECT_FALSE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); |
290 } | 285 } |
291 } // namespace webrtc | 286 } // namespace webrtc |
OLD | NEW |