| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 EXPECT_NOERR(ap->echo_cancellation()->enable_drift_compensation(true)); | 178 EXPECT_NOERR(ap->echo_cancellation()->enable_drift_compensation(true)); |
| 179 EXPECT_NOERR(ap->echo_cancellation()->enable_metrics(true)); | 179 EXPECT_NOERR(ap->echo_cancellation()->enable_metrics(true)); |
| 180 EXPECT_NOERR(ap->echo_cancellation()->enable_delay_logging(true)); | 180 EXPECT_NOERR(ap->echo_cancellation()->enable_delay_logging(true)); |
| 181 EXPECT_NOERR(ap->echo_cancellation()->Enable(true)); | 181 EXPECT_NOERR(ap->echo_cancellation()->Enable(true)); |
| 182 | 182 |
| 183 EXPECT_NOERR(ap->gain_control()->set_mode(GainControl::kAdaptiveAnalog)); | 183 EXPECT_NOERR(ap->gain_control()->set_mode(GainControl::kAdaptiveAnalog)); |
| 184 EXPECT_NOERR(ap->gain_control()->set_analog_level_limits(0, 255)); | 184 EXPECT_NOERR(ap->gain_control()->set_analog_level_limits(0, 255)); |
| 185 EXPECT_NOERR(ap->gain_control()->Enable(true)); | 185 EXPECT_NOERR(ap->gain_control()->Enable(true)); |
| 186 #endif | 186 #endif |
| 187 | 187 |
| 188 EXPECT_NOERR(ap->high_pass_filter()->Enable(true)); | 188 AudioProcessing::Config apm_config; |
| 189 apm_config.high_pass_filter.enabled = true; |
| 190 ap->ApplyConfig(apm_config); |
| 191 |
| 189 EXPECT_NOERR(ap->level_estimator()->Enable(true)); | 192 EXPECT_NOERR(ap->level_estimator()->Enable(true)); |
| 190 EXPECT_NOERR(ap->noise_suppression()->Enable(true)); | 193 EXPECT_NOERR(ap->noise_suppression()->Enable(true)); |
| 191 | 194 |
| 192 EXPECT_NOERR(ap->voice_detection()->Enable(true)); | 195 EXPECT_NOERR(ap->voice_detection()->Enable(true)); |
| 193 } | 196 } |
| 194 | 197 |
| 195 // These functions are only used by ApmTest.Process. | 198 // These functions are only used by ApmTest.Process. |
| 196 template <class T> | 199 template <class T> |
| 197 T AbsValue(T a) { | 200 T AbsValue(T a) { |
| 198 return a > 0 ? a: -a; | 201 return a > 0 ? a: -a; |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 | 1387 |
| 1385 // Turn NS on/off | 1388 // Turn NS on/off |
| 1386 EXPECT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(true)); | 1389 EXPECT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(true)); |
| 1387 EXPECT_TRUE(apm_->noise_suppression()->is_enabled()); | 1390 EXPECT_TRUE(apm_->noise_suppression()->is_enabled()); |
| 1388 EXPECT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(false)); | 1391 EXPECT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(false)); |
| 1389 EXPECT_FALSE(apm_->noise_suppression()->is_enabled()); | 1392 EXPECT_FALSE(apm_->noise_suppression()->is_enabled()); |
| 1390 } | 1393 } |
| 1391 | 1394 |
| 1392 TEST_F(ApmTest, HighPassFilter) { | 1395 TEST_F(ApmTest, HighPassFilter) { |
| 1393 // Turn HP filter on/off | 1396 // Turn HP filter on/off |
| 1394 EXPECT_EQ(apm_->kNoError, apm_->high_pass_filter()->Enable(true)); | 1397 AudioProcessing::Config apm_config; |
| 1395 EXPECT_TRUE(apm_->high_pass_filter()->is_enabled()); | 1398 apm_config.high_pass_filter.enabled = true; |
| 1396 EXPECT_EQ(apm_->kNoError, apm_->high_pass_filter()->Enable(false)); | 1399 apm_->ApplyConfig(apm_config); |
| 1397 EXPECT_FALSE(apm_->high_pass_filter()->is_enabled()); | 1400 apm_config.high_pass_filter.enabled = false; |
| 1401 apm_->ApplyConfig(apm_config); |
| 1398 } | 1402 } |
| 1399 | 1403 |
| 1400 TEST_F(ApmTest, LevelEstimator) { | 1404 TEST_F(ApmTest, LevelEstimator) { |
| 1401 // Turn level estimator on/off | 1405 // Turn level estimator on/off |
| 1402 EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(false)); | 1406 EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(false)); |
| 1403 EXPECT_FALSE(apm_->level_estimator()->is_enabled()); | 1407 EXPECT_FALSE(apm_->level_estimator()->is_enabled()); |
| 1404 | 1408 |
| 1405 EXPECT_EQ(apm_->kNotEnabledError, apm_->level_estimator()->RMS()); | 1409 EXPECT_EQ(apm_->kNotEnabledError, apm_->level_estimator()->RMS()); |
| 1406 | 1410 |
| 1407 EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true)); | 1411 EXPECT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true)); |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2873 // TODO(peah): Remove the testing for | 2877 // TODO(peah): Remove the testing for |
| 2874 // apm->capture_nonlocked_.level_controller_enabled once the value in config_ | 2878 // apm->capture_nonlocked_.level_controller_enabled once the value in config_ |
| 2875 // is instead used to activate the level controller. | 2879 // is instead used to activate the level controller. |
| 2876 EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled); | 2880 EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled); |
| 2877 EXPECT_NEAR(kTargetLcPeakLeveldBFS, | 2881 EXPECT_NEAR(kTargetLcPeakLeveldBFS, |
| 2878 apm->config_.level_controller.initial_peak_level_dbfs, | 2882 apm->config_.level_controller.initial_peak_level_dbfs, |
| 2879 std::numeric_limits<float>::epsilon()); | 2883 std::numeric_limits<float>::epsilon()); |
| 2880 } | 2884 } |
| 2881 | 2885 |
| 2882 } // namespace webrtc | 2886 } // namespace webrtc |
| OLD | NEW |