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