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 AudioProcessing::Config& apm_config); | |
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( |
137 : DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"), 32000, 2, | 138 const Config& config, |
138 ResourcePath("far32_stereo", "pcm"), 32000, 2, | 139 const AudioProcessing::Config& apm_config) |
139 config, | 140 : DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"), |
140 TempFilename(OutputPath(), "debug_aec")) { | 141 32000, |
142 2, | |
143 ResourcePath("far32_stereo", "pcm"), | |
144 32000, | |
145 2, | |
146 config, | |
147 TempFilename(OutputPath(), "debug_aec")) { | |
148 apm_->ApplyConfig(apm_config); | |
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 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
269 generator.StartRecording(); | 277 generator.StartRecording(); |
270 generator.Process(100); | 278 generator.Process(100); |
271 generator.StopRecording(); | 279 generator.StopRecording(); |
272 VerifyDebugDump(generator.dump_file_name()); | 280 VerifyDebugDump(generator.dump_file_name()); |
273 } | 281 } |
274 | 282 |
275 TEST_F(DebugDumpTest, ChangeInputFormat) { | 283 TEST_F(DebugDumpTest, ChangeInputFormat) { |
276 Config config; | 284 Config config; |
277 DebugDumpGenerator generator(config); | 285 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
286 | |
278 generator.StartRecording(); | 287 generator.StartRecording(); |
279 generator.Process(100); | 288 generator.Process(100); |
280 generator.SetInputRate(48000); | 289 generator.SetInputRate(48000); |
281 | 290 |
282 generator.ForceInputMono(true); | 291 generator.ForceInputMono(true); |
283 // Number of output channel should not be larger than that of input. APM will | 292 // Number of output channel should not be larger than that of input. APM will |
284 // fail otherwise. | 293 // fail otherwise. |
285 generator.SetOutputChannels(1); | 294 generator.SetOutputChannels(1); |
286 | 295 |
287 generator.Process(100); | 296 generator.Process(100); |
288 generator.StopRecording(); | 297 generator.StopRecording(); |
289 VerifyDebugDump(generator.dump_file_name()); | 298 VerifyDebugDump(generator.dump_file_name()); |
290 } | 299 } |
291 | 300 |
292 TEST_F(DebugDumpTest, ChangeReverseFormat) { | 301 TEST_F(DebugDumpTest, ChangeReverseFormat) { |
293 Config config; | 302 Config config; |
294 DebugDumpGenerator generator(config); | 303 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
295 generator.StartRecording(); | 304 generator.StartRecording(); |
296 generator.Process(100); | 305 generator.Process(100); |
297 generator.SetReverseRate(48000); | 306 generator.SetReverseRate(48000); |
298 generator.ForceReverseMono(true); | 307 generator.ForceReverseMono(true); |
299 generator.Process(100); | 308 generator.Process(100); |
300 generator.StopRecording(); | 309 generator.StopRecording(); |
301 VerifyDebugDump(generator.dump_file_name()); | 310 VerifyDebugDump(generator.dump_file_name()); |
302 } | 311 } |
303 | 312 |
304 TEST_F(DebugDumpTest, ChangeOutputFormat) { | 313 TEST_F(DebugDumpTest, ChangeOutputFormat) { |
305 Config config; | 314 Config config; |
306 DebugDumpGenerator generator(config); | 315 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
307 generator.StartRecording(); | 316 generator.StartRecording(); |
308 generator.Process(100); | 317 generator.Process(100); |
309 generator.SetOutputRate(48000); | 318 generator.SetOutputRate(48000); |
310 generator.SetOutputChannels(1); | 319 generator.SetOutputChannels(1); |
311 generator.Process(100); | 320 generator.Process(100); |
312 generator.StopRecording(); | 321 generator.StopRecording(); |
313 VerifyDebugDump(generator.dump_file_name()); | 322 VerifyDebugDump(generator.dump_file_name()); |
314 } | 323 } |
315 | 324 |
316 TEST_F(DebugDumpTest, ToggleAec) { | 325 TEST_F(DebugDumpTest, ToggleAec) { |
317 Config config; | 326 Config config; |
318 DebugDumpGenerator generator(config); | 327 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
319 generator.StartRecording(); | 328 generator.StartRecording(); |
320 generator.Process(100); | 329 generator.Process(100); |
321 | 330 |
322 EchoCancellation* aec = generator.apm()->echo_cancellation(); | 331 EchoCancellation* aec = generator.apm()->echo_cancellation(); |
323 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled())); | 332 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled())); |
324 | 333 |
325 generator.Process(100); | 334 generator.Process(100); |
326 generator.StopRecording(); | 335 generator.StopRecording(); |
327 VerifyDebugDump(generator.dump_file_name()); | 336 VerifyDebugDump(generator.dump_file_name()); |
328 } | 337 } |
329 | 338 |
330 TEST_F(DebugDumpTest, ToggleDelayAgnosticAec) { | 339 TEST_F(DebugDumpTest, ToggleDelayAgnosticAec) { |
331 Config config; | 340 Config config; |
341 AudioProcessing::Config apm_config; | |
the sun
2016/09/08 20:32:27
Why the inconsistency - compared to the above?
peah-webrtc
2016/09/09 12:58:26
Done.
| |
332 config.Set<DelayAgnostic>(new DelayAgnostic(true)); | 342 config.Set<DelayAgnostic>(new DelayAgnostic(true)); |
333 DebugDumpGenerator generator(config); | 343 DebugDumpGenerator generator(config, apm_config); |
334 generator.StartRecording(); | 344 generator.StartRecording(); |
335 generator.Process(100); | 345 generator.Process(100); |
336 | 346 |
337 EchoCancellation* aec = generator.apm()->echo_cancellation(); | 347 EchoCancellation* aec = generator.apm()->echo_cancellation(); |
338 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled())); | 348 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(!aec->is_enabled())); |
339 | 349 |
340 generator.Process(100); | 350 generator.Process(100); |
341 generator.StopRecording(); | 351 generator.StopRecording(); |
342 VerifyDebugDump(generator.dump_file_name()); | 352 VerifyDebugDump(generator.dump_file_name()); |
343 } | 353 } |
344 | 354 |
345 TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) { | 355 TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) { |
346 Config config; | 356 Config config; |
357 AudioProcessing::Config apm_config; | |
347 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); | 358 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); |
348 DebugDumpGenerator generator(config); | 359 DebugDumpGenerator generator(config, apm_config); |
349 generator.StartRecording(); | 360 generator.StartRecording(); |
350 generator.Process(100); | 361 generator.Process(100); |
351 generator.StopRecording(); | 362 generator.StopRecording(); |
352 | 363 |
353 DebugDumpReplayer debug_dump_replayer_; | 364 DebugDumpReplayer debug_dump_replayer_; |
354 | 365 |
355 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); | 366 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); |
356 | 367 |
357 while (const rtc::Optional<audioproc::Event> event = | 368 while (const rtc::Optional<audioproc::Event> event = |
358 debug_dump_replayer_.GetNextEvent()) { | 369 debug_dump_replayer_.GetNextEvent()) { |
359 debug_dump_replayer_.RunNextEvent(); | 370 debug_dump_replayer_.RunNextEvent(); |
360 if (event->type() == audioproc::Event::CONFIG) { | 371 if (event->type() == audioproc::Event::CONFIG) { |
361 const audioproc::Config* msg = &event->config(); | 372 const audioproc::Config* msg = &event->config(); |
362 ASSERT_TRUE(msg->has_experiments_description()); | 373 ASSERT_TRUE(msg->has_experiments_description()); |
363 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", | 374 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", |
364 msg->experiments_description().c_str()); | 375 msg->experiments_description().c_str()); |
365 } | 376 } |
366 } | 377 } |
367 } | 378 } |
368 | 379 |
369 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) { | 380 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) { |
370 Config config; | 381 Config config; |
382 AudioProcessing::Config apm_config; | |
371 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); | 383 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); |
372 config.Set<EchoCanceller3>(new EchoCanceller3(true)); | 384 config.Set<EchoCanceller3>(new EchoCanceller3(true)); |
373 DebugDumpGenerator generator(config); | 385 DebugDumpGenerator generator(config, apm_config); |
374 generator.StartRecording(); | 386 generator.StartRecording(); |
375 generator.Process(100); | 387 generator.Process(100); |
376 generator.StopRecording(); | 388 generator.StopRecording(); |
377 | 389 |
378 DebugDumpReplayer debug_dump_replayer_; | 390 DebugDumpReplayer debug_dump_replayer_; |
379 | 391 |
380 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); | 392 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); |
381 | 393 |
382 while (const rtc::Optional<audioproc::Event> event = | 394 while (const rtc::Optional<audioproc::Event> event = |
383 debug_dump_replayer_.GetNextEvent()) { | 395 debug_dump_replayer_.GetNextEvent()) { |
384 debug_dump_replayer_.RunNextEvent(); | 396 debug_dump_replayer_.RunNextEvent(); |
385 if (event->type() == audioproc::Event::CONFIG) { | 397 if (event->type() == audioproc::Event::CONFIG) { |
386 const audioproc::Config* msg = &event->config(); | 398 const audioproc::Config* msg = &event->config(); |
387 ASSERT_TRUE(msg->has_experiments_description()); | 399 ASSERT_TRUE(msg->has_experiments_description()); |
388 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", | 400 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", |
389 msg->experiments_description().c_str()); | 401 msg->experiments_description().c_str()); |
390 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3", | 402 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3", |
391 msg->experiments_description().c_str()); | 403 msg->experiments_description().c_str()); |
392 } | 404 } |
393 } | 405 } |
394 } | 406 } |
395 | 407 |
396 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) { | 408 TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) { |
397 Config config; | 409 Config config; |
410 AudioProcessing::Config apm_config; | |
398 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); | 411 config.Set<RefinedAdaptiveFilter>(new RefinedAdaptiveFilter(true)); |
399 DebugDumpGenerator generator(config); | 412 DebugDumpGenerator generator(config, apm_config); |
400 generator.StartRecording(); | 413 generator.StartRecording(); |
401 generator.Process(100); | 414 generator.Process(100); |
402 generator.StopRecording(); | 415 generator.StopRecording(); |
403 | 416 |
404 DebugDumpReplayer debug_dump_replayer_; | 417 DebugDumpReplayer debug_dump_replayer_; |
405 | 418 |
406 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); | 419 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); |
407 | 420 |
408 while (const rtc::Optional<audioproc::Event> event = | 421 while (const rtc::Optional<audioproc::Event> event = |
409 debug_dump_replayer_.GetNextEvent()) { | 422 debug_dump_replayer_.GetNextEvent()) { |
410 debug_dump_replayer_.RunNextEvent(); | 423 debug_dump_replayer_.RunNextEvent(); |
411 if (event->type() == audioproc::Event::CONFIG) { | 424 if (event->type() == audioproc::Event::CONFIG) { |
412 const audioproc::Config* msg = &event->config(); | 425 const audioproc::Config* msg = &event->config(); |
413 ASSERT_TRUE(msg->has_experiments_description()); | 426 ASSERT_TRUE(msg->has_experiments_description()); |
414 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", | 427 EXPECT_PRED_FORMAT2(testing::IsSubstring, "RefinedAdaptiveFilter", |
415 msg->experiments_description().c_str()); | 428 msg->experiments_description().c_str()); |
416 EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "AEC3", | 429 EXPECT_PRED_FORMAT2(testing::IsNotSubstring, "AEC3", |
417 msg->experiments_description().c_str()); | 430 msg->experiments_description().c_str()); |
418 } | 431 } |
419 } | 432 } |
420 } | 433 } |
421 | 434 |
422 TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) { | 435 TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) { |
423 Config config; | 436 Config config; |
437 AudioProcessing::Config apm_config; | |
424 config.Set<EchoCanceller3>(new EchoCanceller3(true)); | 438 config.Set<EchoCanceller3>(new EchoCanceller3(true)); |
425 DebugDumpGenerator generator(config); | 439 DebugDumpGenerator generator(config, apm_config); |
426 generator.StartRecording(); | 440 generator.StartRecording(); |
427 generator.Process(100); | 441 generator.Process(100); |
428 generator.StopRecording(); | 442 generator.StopRecording(); |
429 | 443 |
430 DebugDumpReplayer debug_dump_replayer_; | 444 DebugDumpReplayer debug_dump_replayer_; |
431 | 445 |
432 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); | 446 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); |
433 | 447 |
434 while (const rtc::Optional<audioproc::Event> event = | 448 while (const rtc::Optional<audioproc::Event> event = |
435 debug_dump_replayer_.GetNextEvent()) { | 449 debug_dump_replayer_.GetNextEvent()) { |
436 debug_dump_replayer_.RunNextEvent(); | 450 debug_dump_replayer_.RunNextEvent(); |
437 if (event->type() == audioproc::Event::CONFIG) { | 451 if (event->type() == audioproc::Event::CONFIG) { |
438 const audioproc::Config* msg = &event->config(); | 452 const audioproc::Config* msg = &event->config(); |
439 ASSERT_TRUE(msg->has_experiments_description()); | 453 ASSERT_TRUE(msg->has_experiments_description()); |
440 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3", | 454 EXPECT_PRED_FORMAT2(testing::IsSubstring, "AEC3", |
441 msg->experiments_description().c_str()); | 455 msg->experiments_description().c_str()); |
442 } | 456 } |
443 } | 457 } |
444 } | 458 } |
445 | 459 |
446 TEST_F(DebugDumpTest, VerifyLevelControllerExperimentalString) { | 460 TEST_F(DebugDumpTest, VerifyLevelControllerExperimentalString) { |
447 Config config; | 461 Config config; |
448 config.Set<LevelControl>(new LevelControl(true)); | 462 AudioProcessing::Config apm_config; |
449 DebugDumpGenerator generator(config); | 463 apm_config.level_controller.enabled = true; |
464 DebugDumpGenerator generator(config, apm_config); | |
450 generator.StartRecording(); | 465 generator.StartRecording(); |
451 generator.Process(100); | 466 generator.Process(100); |
452 generator.StopRecording(); | 467 generator.StopRecording(); |
453 | 468 |
454 DebugDumpReplayer debug_dump_replayer_; | 469 DebugDumpReplayer debug_dump_replayer_; |
455 | 470 |
456 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); | 471 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); |
457 | 472 |
458 while (const rtc::Optional<audioproc::Event> event = | 473 while (const rtc::Optional<audioproc::Event> event = |
459 debug_dump_replayer_.GetNextEvent()) { | 474 debug_dump_replayer_.GetNextEvent()) { |
460 debug_dump_replayer_.RunNextEvent(); | 475 debug_dump_replayer_.RunNextEvent(); |
461 if (event->type() == audioproc::Event::CONFIG) { | 476 if (event->type() == audioproc::Event::CONFIG) { |
462 const audioproc::Config* msg = &event->config(); | 477 const audioproc::Config* msg = &event->config(); |
463 ASSERT_TRUE(msg->has_experiments_description()); | 478 ASSERT_TRUE(msg->has_experiments_description()); |
464 EXPECT_PRED_FORMAT2(testing::IsSubstring, "LevelController", | 479 EXPECT_PRED_FORMAT2(testing::IsSubstring, "LevelController", |
465 msg->experiments_description().c_str()); | 480 msg->experiments_description().c_str()); |
466 } | 481 } |
467 } | 482 } |
468 } | 483 } |
469 | 484 |
470 TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) { | 485 TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) { |
471 Config config; | 486 Config config; |
472 DebugDumpGenerator generator(config); | 487 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
473 generator.StartRecording(); | 488 generator.StartRecording(); |
474 generator.Process(100); | 489 generator.Process(100); |
475 generator.StopRecording(); | 490 generator.StopRecording(); |
476 | 491 |
477 DebugDumpReplayer debug_dump_replayer_; | 492 DebugDumpReplayer debug_dump_replayer_; |
478 | 493 |
479 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); | 494 ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); |
480 | 495 |
481 while (const rtc::Optional<audioproc::Event> event = | 496 while (const rtc::Optional<audioproc::Event> event = |
482 debug_dump_replayer_.GetNextEvent()) { | 497 debug_dump_replayer_.GetNextEvent()) { |
483 debug_dump_replayer_.RunNextEvent(); | 498 debug_dump_replayer_.RunNextEvent(); |
484 if (event->type() == audioproc::Event::CONFIG) { | 499 if (event->type() == audioproc::Event::CONFIG) { |
485 const audioproc::Config* msg = &event->config(); | 500 const audioproc::Config* msg = &event->config(); |
486 ASSERT_TRUE(msg->has_experiments_description()); | 501 ASSERT_TRUE(msg->has_experiments_description()); |
487 EXPECT_EQ(0u, msg->experiments_description().size()); | 502 EXPECT_EQ(0u, msg->experiments_description().size()); |
488 } | 503 } |
489 } | 504 } |
490 } | 505 } |
491 | 506 |
492 TEST_F(DebugDumpTest, ToggleAecLevel) { | 507 TEST_F(DebugDumpTest, ToggleAecLevel) { |
493 Config config; | 508 Config config; |
494 DebugDumpGenerator generator(config); | 509 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
495 EchoCancellation* aec = generator.apm()->echo_cancellation(); | 510 EchoCancellation* aec = generator.apm()->echo_cancellation(); |
496 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(true)); | 511 EXPECT_EQ(AudioProcessing::kNoError, aec->Enable(true)); |
497 EXPECT_EQ(AudioProcessing::kNoError, | 512 EXPECT_EQ(AudioProcessing::kNoError, |
498 aec->set_suppression_level(EchoCancellation::kLowSuppression)); | 513 aec->set_suppression_level(EchoCancellation::kLowSuppression)); |
499 generator.StartRecording(); | 514 generator.StartRecording(); |
500 generator.Process(100); | 515 generator.Process(100); |
501 | 516 |
502 EXPECT_EQ(AudioProcessing::kNoError, | 517 EXPECT_EQ(AudioProcessing::kNoError, |
503 aec->set_suppression_level(EchoCancellation::kHighSuppression)); | 518 aec->set_suppression_level(EchoCancellation::kHighSuppression)); |
504 generator.Process(100); | 519 generator.Process(100); |
505 generator.StopRecording(); | 520 generator.StopRecording(); |
506 VerifyDebugDump(generator.dump_file_name()); | 521 VerifyDebugDump(generator.dump_file_name()); |
507 } | 522 } |
508 | 523 |
509 #if defined(WEBRTC_ANDROID) | 524 #if defined(WEBRTC_ANDROID) |
510 // AGC may not be supported on Android. | 525 // AGC may not be supported on Android. |
511 #define MAYBE_ToggleAgc DISABLED_ToggleAgc | 526 #define MAYBE_ToggleAgc DISABLED_ToggleAgc |
512 #else | 527 #else |
513 #define MAYBE_ToggleAgc ToggleAgc | 528 #define MAYBE_ToggleAgc ToggleAgc |
514 #endif | 529 #endif |
515 TEST_F(DebugDumpTest, MAYBE_ToggleAgc) { | 530 TEST_F(DebugDumpTest, MAYBE_ToggleAgc) { |
516 Config config; | 531 Config config; |
517 DebugDumpGenerator generator(config); | 532 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
518 generator.StartRecording(); | 533 generator.StartRecording(); |
519 generator.Process(100); | 534 generator.Process(100); |
520 | 535 |
521 GainControl* agc = generator.apm()->gain_control(); | 536 GainControl* agc = generator.apm()->gain_control(); |
522 EXPECT_EQ(AudioProcessing::kNoError, agc->Enable(!agc->is_enabled())); | 537 EXPECT_EQ(AudioProcessing::kNoError, agc->Enable(!agc->is_enabled())); |
523 | 538 |
524 generator.Process(100); | 539 generator.Process(100); |
525 generator.StopRecording(); | 540 generator.StopRecording(); |
526 VerifyDebugDump(generator.dump_file_name()); | 541 VerifyDebugDump(generator.dump_file_name()); |
527 } | 542 } |
528 | 543 |
529 TEST_F(DebugDumpTest, ToggleNs) { | 544 TEST_F(DebugDumpTest, ToggleNs) { |
530 Config config; | 545 Config config; |
531 DebugDumpGenerator generator(config); | 546 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
532 generator.StartRecording(); | 547 generator.StartRecording(); |
533 generator.Process(100); | 548 generator.Process(100); |
534 | 549 |
535 NoiseSuppression* ns = generator.apm()->noise_suppression(); | 550 NoiseSuppression* ns = generator.apm()->noise_suppression(); |
536 EXPECT_EQ(AudioProcessing::kNoError, ns->Enable(!ns->is_enabled())); | 551 EXPECT_EQ(AudioProcessing::kNoError, ns->Enable(!ns->is_enabled())); |
537 | 552 |
538 generator.Process(100); | 553 generator.Process(100); |
539 generator.StopRecording(); | 554 generator.StopRecording(); |
540 VerifyDebugDump(generator.dump_file_name()); | 555 VerifyDebugDump(generator.dump_file_name()); |
541 } | 556 } |
542 | 557 |
543 TEST_F(DebugDumpTest, TransientSuppressionOn) { | 558 TEST_F(DebugDumpTest, TransientSuppressionOn) { |
544 Config config; | 559 Config config; |
545 config.Set<ExperimentalNs>(new ExperimentalNs(true)); | 560 config.Set<ExperimentalNs>(new ExperimentalNs(true)); |
546 DebugDumpGenerator generator(config); | 561 DebugDumpGenerator generator(config, AudioProcessing::Config()); |
547 generator.StartRecording(); | 562 generator.StartRecording(); |
548 generator.Process(100); | 563 generator.Process(100); |
549 generator.StopRecording(); | 564 generator.StopRecording(); |
550 VerifyDebugDump(generator.dump_file_name()); | 565 VerifyDebugDump(generator.dump_file_name()); |
551 } | 566 } |
552 | 567 |
553 } // namespace test | 568 } // namespace test |
554 } // namespace webrtc | 569 } // namespace webrtc |
OLD | NEW |