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

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

Issue 2334583002: Revert of Introduced new scheme for controlling the functionality inside the audio processing module (Closed)
Patch Set: 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 30 matching lines...) Expand all
41 DebugDumpGenerator(const std::string& input_file_name, 41 DebugDumpGenerator(const std::string& input_file_name,
42 int input_file_rate_hz, 42 int input_file_rate_hz,
43 int input_channels, 43 int input_channels,
44 const std::string& reverse_file_name, 44 const std::string& reverse_file_name,
45 int reverse_file_rate_hz, 45 int reverse_file_rate_hz,
46 int reverse_channels, 46 int reverse_channels,
47 const Config& config, 47 const Config& config,
48 const std::string& dump_file_name); 48 const std::string& dump_file_name);
49 49
50 // Constructor that uses default input files. 50 // Constructor that uses default input files.
51 explicit DebugDumpGenerator(const Config& config, 51 explicit DebugDumpGenerator(const Config& config);
52 const AudioProcessing::Config& apm_config);
53 52
54 ~DebugDumpGenerator(); 53 ~DebugDumpGenerator();
55 54
56 // Changes the sample rate of the input audio to the APM. 55 // Changes the sample rate of the input audio to the APM.
57 void SetInputRate(int rate_hz); 56 void SetInputRate(int rate_hz);
58 57
59 // Sets if converts stereo input signal to mono by discarding other channels. 58 // Sets if converts stereo input signal to mono by discarding other channels.
60 void ForceInputMono(bool mono); 59 void ForceInputMono(bool mono);
61 60
62 // Changes the sample rate of the reverse audio to the APM. 61 // Changes the sample rate of the reverse audio to the APM.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 input_(new ChannelBuffer<float>(input_config_.num_frames(), 126 input_(new ChannelBuffer<float>(input_config_.num_frames(),
128 input_config_.num_channels())), 127 input_config_.num_channels())),
129 reverse_(new ChannelBuffer<float>(reverse_config_.num_frames(), 128 reverse_(new ChannelBuffer<float>(reverse_config_.num_frames(),
130 reverse_config_.num_channels())), 129 reverse_config_.num_channels())),
131 output_(new ChannelBuffer<float>(output_config_.num_frames(), 130 output_(new ChannelBuffer<float>(output_config_.num_frames(),
132 output_config_.num_channels())), 131 output_config_.num_channels())),
133 apm_(AudioProcessing::Create(config)), 132 apm_(AudioProcessing::Create(config)),
134 dump_file_name_(dump_file_name) { 133 dump_file_name_(dump_file_name) {
135 } 134 }
136 135
137 DebugDumpGenerator::DebugDumpGenerator( 136 DebugDumpGenerator::DebugDumpGenerator(const Config& config)
138 const Config& config, 137 : DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"), 32000, 2,
139 const AudioProcessing::Config& apm_config) 138 ResourcePath("far32_stereo", "pcm"), 32000, 2,
140 : DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"), 139 config,
141 32000, 140 TempFilename(OutputPath(), "debug_aec")) {
142 2,
143 ResourcePath("far32_stereo", "pcm"),
144 32000,
145 2,
146 config,
147 TempFilename(OutputPath(), "debug_aec")) {
148 apm_->ApplyConfig(apm_config);
149 } 141 }
150 142
151 DebugDumpGenerator::~DebugDumpGenerator() { 143 DebugDumpGenerator::~DebugDumpGenerator() {
152 remove(dump_file_name_.c_str()); 144 remove(dump_file_name_.c_str());
153 } 145 }
154 146
155 void DebugDumpGenerator::SetInputRate(int rate_hz) { 147 void DebugDumpGenerator::SetInputRate(int rate_hz) {
156 input_audio_.set_output_rate_hz(rate_hz); 148 input_audio_.set_output_rate_hz(rate_hz);
157 input_config_.set_sample_rate_hz(rate_hz); 149 input_config_.set_sample_rate_hz(rate_hz);
158 MaybeResetBuffer(&input_, input_config_); 150 MaybeResetBuffer(&input_, input_config_);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 ASSERT_EQ(0, memcmp(output->channels()[i], 258 ASSERT_EQ(0, memcmp(output->channels()[i],
267 msg->output_channel(i).data(), 259 msg->output_channel(i).data(),
268 msg->output_channel(i).size())); 260 msg->output_channel(i).size()));
269 } 261 }
270 } 262 }
271 } 263 }
272 } 264 }
273 265
274 TEST_F(DebugDumpTest, SimpleCase) { 266 TEST_F(DebugDumpTest, SimpleCase) {
275 Config config; 267 Config config;
276 DebugDumpGenerator generator(config, AudioProcessing::Config()); 268 DebugDumpGenerator generator(config);
277 generator.StartRecording(); 269 generator.StartRecording();
278 generator.Process(100); 270 generator.Process(100);
279 generator.StopRecording(); 271 generator.StopRecording();
280 VerifyDebugDump(generator.dump_file_name()); 272 VerifyDebugDump(generator.dump_file_name());
281 } 273 }
282 274
283 TEST_F(DebugDumpTest, ChangeInputFormat) { 275 TEST_F(DebugDumpTest, ChangeInputFormat) {
284 Config config; 276 Config config;
285 DebugDumpGenerator generator(config, AudioProcessing::Config()); 277 DebugDumpGenerator generator(config);
286
287 generator.StartRecording(); 278 generator.StartRecording();
288 generator.Process(100); 279 generator.Process(100);
289 generator.SetInputRate(48000); 280 generator.SetInputRate(48000);
290 281
291 generator.ForceInputMono(true); 282 generator.ForceInputMono(true);
292 // Number of output channel should not be larger than that of input. APM will 283 // Number of output channel should not be larger than that of input. APM will
293 // fail otherwise. 284 // fail otherwise.
294 generator.SetOutputChannels(1); 285 generator.SetOutputChannels(1);
295 286
296 generator.Process(100); 287 generator.Process(100);
297 generator.StopRecording(); 288 generator.StopRecording();
298 VerifyDebugDump(generator.dump_file_name()); 289 VerifyDebugDump(generator.dump_file_name());
299 } 290 }
300 291
301 TEST_F(DebugDumpTest, ChangeReverseFormat) { 292 TEST_F(DebugDumpTest, ChangeReverseFormat) {
302 Config config; 293 Config config;
303 DebugDumpGenerator generator(config, AudioProcessing::Config()); 294 DebugDumpGenerator generator(config);
304 generator.StartRecording(); 295 generator.StartRecording();
305 generator.Process(100); 296 generator.Process(100);
306 generator.SetReverseRate(48000); 297 generator.SetReverseRate(48000);
307 generator.ForceReverseMono(true); 298 generator.ForceReverseMono(true);
308 generator.Process(100); 299 generator.Process(100);
309 generator.StopRecording(); 300 generator.StopRecording();
310 VerifyDebugDump(generator.dump_file_name()); 301 VerifyDebugDump(generator.dump_file_name());
311 } 302 }
312 303
313 TEST_F(DebugDumpTest, ChangeOutputFormat) { 304 TEST_F(DebugDumpTest, ChangeOutputFormat) {
314 Config config; 305 Config config;
315 DebugDumpGenerator generator(config, AudioProcessing::Config()); 306 DebugDumpGenerator generator(config);
316 generator.StartRecording(); 307 generator.StartRecording();
317 generator.Process(100); 308 generator.Process(100);
318 generator.SetOutputRate(48000); 309 generator.SetOutputRate(48000);
319 generator.SetOutputChannels(1); 310 generator.SetOutputChannels(1);
320 generator.Process(100); 311 generator.Process(100);
321 generator.StopRecording(); 312 generator.StopRecording();
322 VerifyDebugDump(generator.dump_file_name()); 313 VerifyDebugDump(generator.dump_file_name());
323 } 314 }
324 315
325 TEST_F(DebugDumpTest, ToggleAec) { 316 TEST_F(DebugDumpTest, ToggleAec) {
326 Config config; 317 Config config;
327 DebugDumpGenerator generator(config, AudioProcessing::Config()); 318 DebugDumpGenerator generator(config);
328 generator.StartRecording(); 319 generator.StartRecording();
329 generator.Process(100); 320 generator.Process(100);
330 321
331 EchoCancellation* aec = generator.apm()->echo_cancellation(); 322 EchoCancellation* aec = generator.apm()->echo_cancellation();
332 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled())); 323 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled()));
333 324
334 generator.Process(100); 325 generator.Process(100);
335 generator.StopRecording(); 326 generator.StopRecording();
336 VerifyDebugDump(generator.dump_file_name()); 327 VerifyDebugDump(generator.dump_file_name());
337 } 328 }
338 329
339 TEST_F(DebugDumpTest, ToggleDelayAgnosticAec) { 330 TEST_F(DebugDumpTest, ToggleDelayAgnosticAec) {
340 Config config; 331 Config config;
341 config.Set<DelayAgnostic>(new DelayAgnostic(true)); 332 config.Set<DelayAgnostic>(new DelayAgnostic(true));
342 DebugDumpGenerator generator(config, AudioProcessing::Config()); 333 DebugDumpGenerator generator(config);
343 generator.StartRecording(); 334 generator.StartRecording();
344 generator.Process(100); 335 generator.Process(100);
345 336
346 EchoCancellation* aec = generator.apm()->echo_cancellation(); 337 EchoCancellation* aec = generator.apm()->echo_cancellation();
347 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled())); 338 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled()));
348 339
349 generator.Process(100); 340 generator.Process(100);
350 generator.StopRecording(); 341 generator.StopRecording();
351 VerifyDebugDump(generator.dump_file_name()); 342 VerifyDebugDump(generator.dump_file_name());
352 } 343 }
353 344
354 TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) { 345 TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) {
355 Config config; 346 Config config;
356 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); 347 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
357 DebugDumpGenerator generator(config, AudioProcessing::Config()); 348 DebugDumpGenerator generator(config);
358 generator.StartRecording(); 349 generator.StartRecording();
359 generator.Process(100); 350 generator.Process(100);
360 generator.StopRecording(); 351 generator.StopRecording();
361 352
362 DebugDumpReplayer debug_dump_replayer_; 353 DebugDumpReplayer debug_dump_replayer_;
363 354
364 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); 355 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
365 356
366 while (const rtc::Optional<audioproc::Event> event = 357 while (const rtc::Optional<audioproc::Event> event =
367 debug_dump_replayer_.GetNextEvent()) { 358 debug_dump_replayer_.GetNextEvent()) {
368 debug_dump_replayer_.RunNextEvent(); 359 debug_dump_replayer_.RunNextEvent();
369 if (event->type() == audioproc::Event::CONFIG) { 360 if (event->type() == audioproc::Event::CONFIG) {
370 const audioproc::Config* msg = &event->config(); 361 const audioproc::Config* msg = &event->config();
371 ASSERT_TRUE(msg->has_experiments_description()); 362 ASSERT_TRUE(msg->has_experiments_description());
372 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", 363 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
373 msg->experiments_description().c_str()); 364 msg->experiments_description().c_str());
374 } 365 }
375 } 366 }
376 } 367 }
377 368
378 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) { 369 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
379 Config config; 370 Config config;
380 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); 371 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
381 config.Set<EchoCanceller3>(new EchoCanceller3(true)); 372 config.Set<EchoCanceller3>(new EchoCanceller3(true));
382 DebugDumpGenerator generator(config, AudioProcessing::Config()); 373 DebugDumpGenerator generator(config);
383 generator.StartRecording(); 374 generator.StartRecording();
384 generator.Process(100); 375 generator.Process(100);
385 generator.StopRecording(); 376 generator.StopRecording();
386 377
387 DebugDumpReplayer debug_dump_replayer_; 378 DebugDumpReplayer debug_dump_replayer_;
388 379
389 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); 380 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
390 381
391 while (const rtc::Optional<audioproc::Event> event = 382 while (const rtc::Optional<audioproc::Event> event =
392 debug_dump_replayer_.GetNextEvent()) { 383 debug_dump_replayer_.GetNextEvent()) {
393 debug_dump_replayer_.RunNextEvent(); 384 debug_dump_replayer_.RunNextEvent();
394 if (event->type() == audioproc::Event::CONFIG) { 385 if (event->type() == audioproc::Event::CONFIG) {
395 const audioproc::Config* msg = &event->config(); 386 const audioproc::Config* msg = &event->config();
396 ASSERT_TRUE(msg->has_experiments_description()); 387 ASSERT_TRUE(msg->has_experiments_description());
397 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", 388 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
398 msg->experiments_description().c_str()); 389 msg->experiments_description().c_str());
399 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3", 390 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3",
400 msg->experiments_description().c_str()); 391 msg->experiments_description().c_str());
401 } 392 }
402 } 393 }
403 } 394 }
404 395
405 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) { 396 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
406 Config config; 397 Config config;
407 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); 398 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true));
408 DebugDumpGenerator generator(config, AudioProcessing::Config()); 399 DebugDumpGenerator generator(config);
409 generator.StartRecording(); 400 generator.StartRecording();
410 generator.Process(100); 401 generator.Process(100);
411 generator.StopRecording(); 402 generator.StopRecording();
412 403
413 DebugDumpReplayer debug_dump_replayer_; 404 DebugDumpReplayer debug_dump_replayer_;
414 405
415 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); 406 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
416 407
417 while (const rtc::Optional<audioproc::Event> event = 408 while (const rtc::Optional<audioproc::Event> event =
418 debug_dump_replayer_.GetNextEvent()) { 409 debug_dump_replayer_.GetNextEvent()) {
419 debug_dump_replayer_.RunNextEvent(); 410 debug_dump_replayer_.RunNextEvent();
420 if (event->type() == audioproc::Event::CONFIG) { 411 if (event->type() == audioproc::Event::CONFIG) {
421 const audioproc::Config* msg = &event->config(); 412 const audioproc::Config* msg = &event->config();
422 ASSERT_TRUE(msg->has_experiments_description()); 413 ASSERT_TRUE(msg->has_experiments_description());
423 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", 414 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter",
424 msg->experiments_description().c_str()); 415 msg->experiments_description().c_str());
425 EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "AEC3", 416 EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "AEC3",
426 msg->experiments_description().c_str()); 417 msg->experiments_description().c_str());
427 } 418 }
428 } 419 }
429 } 420 }
430 421
431 TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) { 422 TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
432 Config config; 423 Config config;
433 config.Set<EchoCanceller3>(new EchoCanceller3(true)); 424 config.Set<EchoCanceller3>(new EchoCanceller3(true));
434 DebugDumpGenerator generator(config, AudioProcessing::Config()); 425 DebugDumpGenerator generator(config);
435 generator.StartRecording(); 426 generator.StartRecording();
436 generator.Process(100); 427 generator.Process(100);
437 generator.StopRecording(); 428 generator.StopRecording();
438 429
439 DebugDumpReplayer debug_dump_replayer_; 430 DebugDumpReplayer debug_dump_replayer_;
440 431
441 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); 432 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
442 433
443 while (const rtc::Optional<audioproc::Event> event = 434 while (const rtc::Optional<audioproc::Event> event =
444 debug_dump_replayer_.GetNextEvent()) { 435 debug_dump_replayer_.GetNextEvent()) {
445 debug_dump_replayer_.RunNextEvent(); 436 debug_dump_replayer_.RunNextEvent();
446 if (event->type() == audioproc::Event::CONFIG) { 437 if (event->type() == audioproc::Event::CONFIG) {
447 const audioproc::Config* msg = &event->config(); 438 const audioproc::Config* msg = &event->config();
448 ASSERT_TRUE(msg->has_experiments_description()); 439 ASSERT_TRUE(msg->has_experiments_description());
449 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3", 440 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3",
450 msg->experiments_description().c_str()); 441 msg->experiments_description().c_str());
451 } 442 }
452 } 443 }
453 } 444 }
454 445
455 TEST_F(DebugDumpTest, VerifyLevelControllerExperimentalString) { 446 TEST_F(DebugDumpTest, VerifyLevelControllerExperimentalString) {
456 Config config; 447 Config config;
457 AudioProcessing::Config apm_config; 448 config.Set<LevelControl>(new LevelControl(true));
458 apm_config.level_controller.enabled = true; 449 DebugDumpGenerator generator(config);
459 DebugDumpGenerator generator(config, apm_config);
460 generator.StartRecording(); 450 generator.StartRecording();
461 generator.Process(100); 451 generator.Process(100);
462 generator.StopRecording(); 452 generator.StopRecording();
463 453
464 DebugDumpReplayer debug_dump_replayer_; 454 DebugDumpReplayer debug_dump_replayer_;
465 455
466 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); 456 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
467 457
468 while (const rtc::Optional<audioproc::Event> event = 458 while (const rtc::Optional<audioproc::Event> event =
469 debug_dump_replayer_.GetNextEvent()) { 459 debug_dump_replayer_.GetNextEvent()) {
470 debug_dump_replayer_.RunNextEvent(); 460 debug_dump_replayer_.RunNextEvent();
471 if (event->type() == audioproc::Event::CONFIG) { 461 if (event->type() == audioproc::Event::CONFIG) {
472 const audioproc::Config* msg = &event->config(); 462 const audioproc::Config* msg = &event->config();
473 ASSERT_TRUE(msg->has_experiments_description()); 463 ASSERT_TRUE(msg->has_experiments_description());
474 EXPECT_PRED_FORMAT2(testing::IsSubstring, "LevelController", 464 EXPECT_PRED_FORMAT2(testing::IsSubstring, "LevelController",
475 msg->experiments_description().c_str()); 465 msg->experiments_description().c_str());
476 } 466 }
477 } 467 }
478 } 468 }
479 469
480 TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) { 470 TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) {
481 Config config; 471 Config config;
482 DebugDumpGenerator generator(config, AudioProcessing::Config()); 472 DebugDumpGenerator generator(config);
483 generator.StartRecording(); 473 generator.StartRecording();
484 generator.Process(100); 474 generator.Process(100);
485 generator.StopRecording(); 475 generator.StopRecording();
486 476
487 DebugDumpReplayer debug_dump_replayer_; 477 DebugDumpReplayer debug_dump_replayer_;
488 478
489 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); 479 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
490 480
491 while (const rtc::Optional<audioproc::Event> event = 481 while (const rtc::Optional<audioproc::Event> event =
492 debug_dump_replayer_.GetNextEvent()) { 482 debug_dump_replayer_.GetNextEvent()) {
493 debug_dump_replayer_.RunNextEvent(); 483 debug_dump_replayer_.RunNextEvent();
494 if (event->type() == audioproc::Event::CONFIG) { 484 if (event->type() == audioproc::Event::CONFIG) {
495 const audioproc::Config* msg = &event->config(); 485 const audioproc::Config* msg = &event->config();
496 ASSERT_TRUE(msg->has_experiments_description()); 486 ASSERT_TRUE(msg->has_experiments_description());
497 EXPECT_EQ(0u, msg->experiments_description().size()); 487 EXPECT_EQ(0u, msg->experiments_description().size());
498 } 488 }
499 } 489 }
500 } 490 }
501 491
502 TEST_F(DebugDumpTest, ToggleAecLevel) { 492 TEST_F(DebugDumpTest, ToggleAecLevel) {
503 Config config; 493 Config config;
504 DebugDumpGenerator generator(config, AudioProcessing::Config()); 494 DebugDumpGenerator generator(config);
505 EchoCancellation* aec = generator.apm()->echo_cancellation(); 495 EchoCancellation* aec = generator.apm()->echo_cancellation();
506 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(true)); 496 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(true));
507 EXPECT_EQ(AudioProcessing::kNoError, 497 EXPECT_EQ(AudioProcessing::kNoError,
508 aec->set_suppression_level(EchoCancellation::kLowSuppression)); 498 aec->set_suppression_level(EchoCancellation::kLowSuppression));
509 generator.StartRecording(); 499 generator.StartRecording();
510 generator.Process(100); 500 generator.Process(100);
511 501
512 EXPECT_EQ(AudioProcessing::kNoError, 502 EXPECT_EQ(AudioProcessing::kNoError,
513 aec->set_suppression_level(EchoCancellation::kHighSuppression)); 503 aec->set_suppression_level(EchoCancellation::kHighSuppression));
514 generator.Process(100); 504 generator.Process(100);
515 generator.StopRecording(); 505 generator.StopRecording();
516 VerifyDebugDump(generator.dump_file_name()); 506 VerifyDebugDump(generator.dump_file_name());
517 } 507 }
518 508
519 #if defined(WEBRTC_ANDROID) 509 #if defined(WEBRTC_ANDROID)
520 // AGC may not be supported on Android. 510 // AGC may not be supported on Android.
521 #define MAYBE_ToggleAgc DISABLED_ToggleAgc 511 #define MAYBE_ToggleAgc DISABLED_ToggleAgc
522 #else 512 #else
523 #define MAYBE_ToggleAgc ToggleAgc 513 #define MAYBE_ToggleAgc ToggleAgc
524 #endif 514 #endif
525 TEST_F(DebugDumpTest, MAYBE_ToggleAgc) { 515 TEST_F(DebugDumpTest, MAYBE_ToggleAgc) {
526 Config config; 516 Config config;
527 DebugDumpGenerator generator(config, AudioProcessing::Config()); 517 DebugDumpGenerator generator(config);
528 generator.StartRecording(); 518 generator.StartRecording();
529 generator.Process(100); 519 generator.Process(100);
530 520
531 GainControl* agc = generator.apm()->gain_control(); 521 GainControl* agc = generator.apm()->gain_control();
532 EXPECT_EQ(AudioProcessing::kNoError, agc->Enable(!agc->is_enabled())); 522 EXPECT_EQ(AudioProcessing::kNoError, agc->Enable(!agc->is_enabled()));
533 523
534 generator.Process(100); 524 generator.Process(100);
535 generator.StopRecording(); 525 generator.StopRecording();
536 VerifyDebugDump(generator.dump_file_name()); 526 VerifyDebugDump(generator.dump_file_name());
537 } 527 }
538 528
539 TEST_F(DebugDumpTest, ToggleNs) { 529 TEST_F(DebugDumpTest, ToggleNs) {
540 Config config; 530 Config config;
541 DebugDumpGenerator generator(config, AudioProcessing::Config()); 531 DebugDumpGenerator generator(config);
542 generator.StartRecording(); 532 generator.StartRecording();
543 generator.Process(100); 533 generator.Process(100);
544 534
545 NoiseSuppression* ns = generator.apm()->noise_suppression(); 535 NoiseSuppression* ns = generator.apm()->noise_suppression();
546 EXPECT_EQ(AudioProcessing::kNoError, ns->Enable(!ns->is_enabled())); 536 EXPECT_EQ(AudioProcessing::kNoError, ns->Enable(!ns->is_enabled()));
547 537
548 generator.Process(100); 538 generator.Process(100);
549 generator.StopRecording(); 539 generator.StopRecording();
550 VerifyDebugDump(generator.dump_file_name()); 540 VerifyDebugDump(generator.dump_file_name());
551 } 541 }
552 542
553 TEST_F(DebugDumpTest, TransientSuppressionOn) { 543 TEST_F(DebugDumpTest, TransientSuppressionOn) {
554 Config config; 544 Config config;
555 config.Set<ExperimentalNs>(new ExperimentalNs(true)); 545 config.Set<ExperimentalNs>(new ExperimentalNs(true));
556 DebugDumpGenerator generator(config, AudioProcessing::Config()); 546 DebugDumpGenerator generator(config);
557 generator.StartRecording(); 547 generator.StartRecording();
558 generator.Process(100); 548 generator.Process(100);
559 generator.StopRecording(); 549 generator.StopRecording();
560 VerifyDebugDump(generator.dump_file_name()); 550 VerifyDebugDump(generator.dump_file_name());
561 } 551 }
562 552
563 } // namespace test 553 } // namespace test
564 } // namespace webrtc 554 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698