| 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 "webrtc/media/engine/apm_helpers.h" | 11 #include "webrtc/media/engine/apm_helpers.h" |
| 12 | 12 |
| 13 #include "webrtc/media/engine/webrtcvoe.h" | 13 #include "webrtc/media/engine/webrtcvoe.h" |
| 14 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" | 14 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" |
| 15 #include "webrtc/modules/audio_device/include/mock_audio_device.h" | 15 #include "webrtc/modules/audio_device/include/mock_audio_device.h" |
| 16 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 16 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 17 #include "webrtc/test/gmock.h" | 17 #include "webrtc/test/gmock.h" |
| 18 #include "webrtc/test/gtest.h" | 18 #include "webrtc/test/gtest.h" |
| 19 #include "webrtc/voice_engine/transmit_mixer.h" | 19 #include "webrtc/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 |
| 28 // This replicates the conditions from voe_auto_test. | 33 // This replicates the conditions from voe_auto_test. |
| 29 Config config; | 34 Config config; |
| 30 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); | 35 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
| 31 EXPECT_EQ(0, voe_wrapper_.base()->Init( | 36 EXPECT_EQ(0, voe_wrapper_.base()->Init( |
| 32 &mock_audio_device_, | 37 &mock_audio_device_, |
| 33 AudioProcessing::Create(config), | 38 AudioProcessing::Create(config), |
| 34 MockAudioDecoderFactory::CreateEmptyFactory())); | 39 MockAudioDecoderFactory::CreateEmptyFactory())); |
| 35 } | 40 } |
| 36 | 41 |
| 37 AudioProcessing* apm() { | 42 AudioProcessing* apm() { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // TODO(solenberg): Move this test to a better place - added here for the sake | 279 // TODO(solenberg): Move this test to a better place - added here for the sake |
| 275 // of duplicating all relevant tests from audio_processing_test.cc. | 280 // of duplicating all relevant tests from audio_processing_test.cc. |
| 276 TEST(ApmHelpersTest, StereoSwapping_EnableDisable) { | 281 TEST(ApmHelpersTest, StereoSwapping_EnableDisable) { |
| 277 TestHelper helper; | 282 TestHelper helper; |
| 278 helper.transmit_mixer()->EnableStereoChannelSwapping(true); | 283 helper.transmit_mixer()->EnableStereoChannelSwapping(true); |
| 279 EXPECT_TRUE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); | 284 EXPECT_TRUE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); |
| 280 helper.transmit_mixer()->EnableStereoChannelSwapping(false); | 285 helper.transmit_mixer()->EnableStereoChannelSwapping(false); |
| 281 EXPECT_FALSE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); | 286 EXPECT_FALSE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); |
| 282 } | 287 } |
| 283 } // namespace webrtc | 288 } // namespace webrtc |
| OLD | NEW |