Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Side by Side Diff: webrtc/modules/audio_processing/test/audio_processing_simulator.cc

Issue 2292863002: Introduced new scheme for controlling the functionality inside the audio processing module (Closed)
Patch Set: Fixed bad merge Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 void AudioProcessingSimulator::DestroyAudioProcessor() { 213 void AudioProcessingSimulator::DestroyAudioProcessor() {
214 if (settings_.aec_dump_output_filename) { 214 if (settings_.aec_dump_output_filename) {
215 RTC_CHECK_EQ(AudioProcessing::kNoError, ap_->StopDebugRecording()); 215 RTC_CHECK_EQ(AudioProcessing::kNoError, ap_->StopDebugRecording());
216 } 216 }
217 } 217 }
218 218
219 void AudioProcessingSimulator::CreateAudioProcessor() { 219 void AudioProcessingSimulator::CreateAudioProcessor() {
220 Config config; 220 Config config;
221 AudioProcessing::Config apm_config;
221 if (settings_.use_bf && *settings_.use_bf) { 222 if (settings_.use_bf && *settings_.use_bf) {
222 config.Set<Beamforming>(new Beamforming( 223 config.Set<Beamforming>(new Beamforming(
223 true, ParseArrayGeometry(*settings_.microphone_positions), 224 true, ParseArrayGeometry(*settings_.microphone_positions),
224 SphericalPointf(DegreesToRadians(settings_.target_angle_degrees), 0.f, 225 SphericalPointf(DegreesToRadians(settings_.target_angle_degrees), 0.f,
225 1.f))); 226 1.f)));
226 } 227 }
227 if (settings_.use_ts) { 228 if (settings_.use_ts) {
228 config.Set<ExperimentalNs>(new ExperimentalNs(*settings_.use_ts)); 229 config.Set<ExperimentalNs>(new ExperimentalNs(*settings_.use_ts));
229 } 230 }
230 if (settings_.use_ie) { 231 if (settings_.use_ie) {
231 config.Set<Intelligibility>(new Intelligibility(*settings_.use_ie)); 232 config.Set<Intelligibility>(new Intelligibility(*settings_.use_ie));
232 } 233 }
233 if (settings_.use_aec3) { 234 if (settings_.use_aec3) {
234 config.Set<EchoCanceller3>(new EchoCanceller3(*settings_.use_aec3)); 235 config.Set<EchoCanceller3>(new EchoCanceller3(*settings_.use_aec3));
235 } 236 }
236 if (settings_.use_lc) { 237 if (settings_.use_lc) {
237 config.Set<LevelControl>(new LevelControl(true)); 238 apm_config.level_controller.enabled = *settings_.use_lc;
238 } 239 }
239 if (settings_.use_refined_adaptive_filter) { 240 if (settings_.use_refined_adaptive_filter) {
240 config.Set<RefinedAdaptiveFilter>( 241 config.Set<RefinedAdaptiveFilter>(
241 new RefinedAdaptiveFilter(*settings_.use_refined_adaptive_filter)); 242 new RefinedAdaptiveFilter(*settings_.use_refined_adaptive_filter));
242 } 243 }
243 config.Set<ExtendedFilter>(new ExtendedFilter( 244 config.Set<ExtendedFilter>(new ExtendedFilter(
244 !settings_.use_extended_filter || *settings_.use_extended_filter)); 245 !settings_.use_extended_filter || *settings_.use_extended_filter));
245 config.Set<DelayAgnostic>(new DelayAgnostic(!settings_.use_delay_agnostic || 246 config.Set<DelayAgnostic>(new DelayAgnostic(!settings_.use_delay_agnostic ||
246 *settings_.use_delay_agnostic)); 247 *settings_.use_delay_agnostic));
247 248
248 ap_.reset(AudioProcessing::Create(config)); 249 ap_.reset(AudioProcessing::Create(config));
250 RTC_CHECK(ap_);
251
252 ap_->ApplyConfig(apm_config);
249 253
250 if (settings_.use_aec) { 254 if (settings_.use_aec) {
251 RTC_CHECK_EQ(AudioProcessing::kNoError, 255 RTC_CHECK_EQ(AudioProcessing::kNoError,
252 ap_->echo_cancellation()->Enable(*settings_.use_aec)); 256 ap_->echo_cancellation()->Enable(*settings_.use_aec));
253 } 257 }
254 if (settings_.use_aecm) { 258 if (settings_.use_aecm) {
255 RTC_CHECK_EQ(AudioProcessing::kNoError, 259 RTC_CHECK_EQ(AudioProcessing::kNoError,
256 ap_->echo_control_mobile()->Enable(*settings_.use_aecm)); 260 ap_->echo_control_mobile()->Enable(*settings_.use_aecm));
257 } 261 }
258 if (settings_.use_agc) { 262 if (settings_.use_agc) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize; 343 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize;
340 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize); 344 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize);
341 RTC_CHECK_EQ(AudioProcessing::kNoError, 345 RTC_CHECK_EQ(AudioProcessing::kNoError,
342 ap_->StartDebugRecording( 346 ap_->StartDebugRecording(
343 settings_.aec_dump_output_filename->c_str(), -1)); 347 settings_.aec_dump_output_filename->c_str(), -1));
344 } 348 }
345 } 349 }
346 350
347 } // namespace test 351 } // namespace test
348 } // namespace webrtc 352 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698