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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 struct TestHelper { | 26 struct TestHelper { |
27 TestHelper() { | 27 TestHelper() { |
28 // Reply with a 10ms timer every time TimeUntilNextProcess is called to | 28 // Reply with a 10ms timer every time TimeUntilNextProcess is called to |
29 // avoid entering a tight loop on the process thread. | 29 // avoid entering a tight loop on the process thread. |
30 EXPECT_CALL(mock_audio_device_, TimeUntilNextProcess()) | 30 EXPECT_CALL(mock_audio_device_, TimeUntilNextProcess()) |
31 .WillRepeatedly(testing::Return(10)); | 31 .WillRepeatedly(testing::Return(10)); |
32 | 32 |
33 // This replicates the conditions from voe_auto_test. | 33 // This replicates the conditions from voe_auto_test. |
34 Config config; | 34 Config config; |
35 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); | 35 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
| 36 apm_ = rtc::scoped_refptr<AudioProcessing>(AudioProcessing::Create(config)); |
36 EXPECT_EQ(0, voe_wrapper_.base()->Init( | 37 EXPECT_EQ(0, voe_wrapper_.base()->Init( |
37 &mock_audio_device_, | 38 &mock_audio_device_, apm_, |
38 AudioProcessing::Create(config), | 39 MockAudioDecoderFactory::CreateEmptyFactory())); |
39 MockAudioDecoderFactory::CreateEmptyFactory())); | |
40 } | 40 } |
41 | 41 |
42 AudioProcessing* apm() { | 42 AudioProcessing* apm() { return apm_.get(); } |
43 return voe_wrapper_.base()->audio_processing(); | |
44 } | |
45 | 43 |
46 const AudioProcessing* apm() const { | 44 const AudioProcessing* apm() const { return apm_.get(); } |
47 return voe_wrapper_.base()->audio_processing(); | |
48 } | |
49 | 45 |
50 test::MockAudioDeviceModule* adm() { | 46 test::MockAudioDeviceModule* adm() { |
51 return &mock_audio_device_; | 47 return &mock_audio_device_; |
52 } | 48 } |
53 | 49 |
54 voe::TransmitMixer* transmit_mixer() { | 50 voe::TransmitMixer* transmit_mixer() { |
55 return voe_wrapper_.base()->transmit_mixer(); | 51 return voe_wrapper_.base()->transmit_mixer(); |
56 } | 52 } |
57 | 53 |
58 bool GetEcMetricsStatus() const { | 54 bool GetEcMetricsStatus() const { |
(...skipping 11 matching lines...) Expand all Loading... |
70 int std = 0; | 66 int std = 0; |
71 float fraction = 0; | 67 float fraction = 0; |
72 int delay_metrics_result = ec->GetDelayMetrics(&median, &std, &fraction); | 68 int delay_metrics_result = ec->GetDelayMetrics(&median, &std, &fraction); |
73 return metrics_result == AudioProcessing::kNoError && | 69 return metrics_result == AudioProcessing::kNoError && |
74 delay_metrics_result == AudioProcessing::kNoError; | 70 delay_metrics_result == AudioProcessing::kNoError; |
75 } | 71 } |
76 | 72 |
77 private: | 73 private: |
78 testing::NiceMock<test::MockAudioDeviceModule> mock_audio_device_; | 74 testing::NiceMock<test::MockAudioDeviceModule> mock_audio_device_; |
79 cricket::VoEWrapper voe_wrapper_; | 75 cricket::VoEWrapper voe_wrapper_; |
| 76 rtc::scoped_refptr<AudioProcessing> apm_; |
80 }; | 77 }; |
81 } // namespace | 78 } // namespace |
82 | 79 |
83 TEST(ApmHelpersTest, AgcConfig_DefaultConfiguration) { | 80 TEST(ApmHelpersTest, AgcConfig_DefaultConfiguration) { |
84 TestHelper helper; | 81 TestHelper helper; |
85 AgcConfig agc_config = | 82 AgcConfig agc_config = |
86 apm_helpers::GetAgcConfig(helper.apm()); | 83 apm_helpers::GetAgcConfig(helper.apm()); |
87 | 84 |
88 EXPECT_EQ(kDefaultAgcConfig.targetLeveldBOv, agc_config.targetLeveldBOv); | 85 EXPECT_EQ(kDefaultAgcConfig.targetLeveldBOv, agc_config.targetLeveldBOv); |
89 EXPECT_EQ(kDefaultAgcConfig.digitalCompressionGaindB, | 86 EXPECT_EQ(kDefaultAgcConfig.digitalCompressionGaindB, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // TODO(solenberg): Move this test to a better place - added here for the sake | 272 // TODO(solenberg): Move this test to a better place - added here for the sake |
276 // of duplicating all relevant tests from audio_processing_test.cc. | 273 // of duplicating all relevant tests from audio_processing_test.cc. |
277 TEST(ApmHelpersTest, StereoSwapping_EnableDisable) { | 274 TEST(ApmHelpersTest, StereoSwapping_EnableDisable) { |
278 TestHelper helper; | 275 TestHelper helper; |
279 helper.transmit_mixer()->EnableStereoChannelSwapping(true); | 276 helper.transmit_mixer()->EnableStereoChannelSwapping(true); |
280 EXPECT_TRUE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); | 277 EXPECT_TRUE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); |
281 helper.transmit_mixer()->EnableStereoChannelSwapping(false); | 278 helper.transmit_mixer()->EnableStereoChannelSwapping(false); |
282 EXPECT_FALSE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); | 279 EXPECT_FALSE(helper.transmit_mixer()->IsStereoChannelSwappingEnabled()); |
283 } | 280 } |
284 } // namespace webrtc | 281 } // namespace webrtc |
OLD | NEW |