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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 // Tests whether all the required render and capture side calls have been | 438 // Tests whether all the required render and capture side calls have been |
439 // done. | 439 // done. |
440 bool TestDone() { | 440 bool TestDone() { |
441 return frame_counters_.BothCountersExceedeThreshold( | 441 return frame_counters_.BothCountersExceedeThreshold( |
442 test_config_.min_number_of_calls); | 442 test_config_.min_number_of_calls); |
443 } | 443 } |
444 | 444 |
445 // Start the threads used in the test. | 445 // Start the threads used in the test. |
446 void StartThreads() { | 446 void StartThreads() { |
447 ASSERT_TRUE(render_thread_->Start()); | 447 render_thread_.Start(); |
448 render_thread_->SetPriority(kRealtimePriority); | 448 render_thread_.SetPriority(rtc::kRealtimePriority); |
449 ASSERT_TRUE(capture_thread_->Start()); | 449 capture_thread_.Start(); |
450 capture_thread_->SetPriority(kRealtimePriority); | 450 capture_thread_.SetPriority(rtc::kRealtimePriority); |
451 ASSERT_TRUE(stats_thread_->Start()); | 451 stats_thread_.Start(); |
452 stats_thread_->SetPriority(kNormalPriority); | 452 stats_thread_.SetPriority(rtc::kNormalPriority); |
453 } | 453 } |
454 | 454 |
455 // Event handler for the test. | 455 // Event handler for the test. |
456 const rtc::scoped_ptr<EventWrapper> test_complete_; | 456 const rtc::scoped_ptr<EventWrapper> test_complete_; |
457 | 457 |
458 // Thread related variables. | 458 // Thread related variables. |
459 rtc::scoped_ptr<PlatformThread> render_thread_; | 459 rtc::PlatformThread render_thread_; |
460 rtc::scoped_ptr<PlatformThread> capture_thread_; | 460 rtc::PlatformThread capture_thread_; |
461 rtc::scoped_ptr<PlatformThread> stats_thread_; | 461 rtc::PlatformThread stats_thread_; |
462 mutable test::Random rand_gen_; | 462 mutable test::Random rand_gen_; |
463 | 463 |
464 rtc::scoped_ptr<AudioProcessing> apm_; | 464 rtc::scoped_ptr<AudioProcessing> apm_; |
465 TestConfig test_config_; | 465 TestConfig test_config_; |
466 FrameCounters frame_counters_; | 466 FrameCounters frame_counters_; |
467 CaptureSideCalledChecker capture_call_checker_; | 467 CaptureSideCalledChecker capture_call_checker_; |
468 RenderProcessor render_thread_state_; | 468 RenderProcessor render_thread_state_; |
469 CaptureProcessor capture_thread_state_; | 469 CaptureProcessor capture_thread_state_; |
470 StatsProcessor stats_thread_state_; | 470 StatsProcessor stats_thread_state_; |
471 }; | 471 }; |
472 | 472 |
473 AudioProcessingImplLockTest::AudioProcessingImplLockTest() | 473 AudioProcessingImplLockTest::AudioProcessingImplLockTest() |
474 : test_complete_(EventWrapper::Create()), | 474 : test_complete_(EventWrapper::Create()), |
475 render_thread_(PlatformThread::CreateThread(RenderProcessorThreadFunc, | 475 render_thread_(RenderProcessorThreadFunc, this, "render"), |
476 this, | 476 capture_thread_(CaptureProcessorThreadFunc, this, "capture"), |
477 "render")), | 477 stats_thread_(StatsProcessorThreadFunc, this, "stats"), |
478 capture_thread_(PlatformThread::CreateThread(CaptureProcessorThreadFunc, | |
479 this, | |
480 "capture")), | |
481 stats_thread_(PlatformThread::CreateThread(StatsProcessorThreadFunc, | |
482 this, | |
483 "stats")), | |
484 rand_gen_(42U), | 478 rand_gen_(42U), |
485 apm_(AudioProcessingImpl::Create()), | 479 apm_(AudioProcessingImpl::Create()), |
486 render_thread_state_(kMaxFrameSize, | 480 render_thread_state_(kMaxFrameSize, |
487 &rand_gen_, | 481 &rand_gen_, |
488 &frame_counters_, | 482 &frame_counters_, |
489 &capture_call_checker_, | 483 &capture_call_checker_, |
490 this, | 484 this, |
491 &test_config_, | 485 &test_config_, |
492 apm_.get()), | 486 apm_.get()), |
493 capture_thread_state_(kMaxFrameSize, | 487 capture_thread_state_(kMaxFrameSize, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 540 |
547 config.Set<DelayAgnostic>( | 541 config.Set<DelayAgnostic>( |
548 new DelayAgnostic(test_config_.aec_type == | 542 new DelayAgnostic(test_config_.aec_type == |
549 AecType::BasicWebRtcAecSettingsWithDelayAgnosticAec)); | 543 AecType::BasicWebRtcAecSettingsWithDelayAgnosticAec)); |
550 | 544 |
551 apm_->SetExtraOptions(config); | 545 apm_->SetExtraOptions(config); |
552 } | 546 } |
553 } | 547 } |
554 | 548 |
555 void AudioProcessingImplLockTest::TearDown() { | 549 void AudioProcessingImplLockTest::TearDown() { |
556 render_thread_->Stop(); | 550 render_thread_.Stop(); |
557 capture_thread_->Stop(); | 551 capture_thread_.Stop(); |
558 stats_thread_->Stop(); | 552 stats_thread_.Stop(); |
559 } | 553 } |
560 | 554 |
561 StatsProcessor::StatsProcessor(test::Random* rand_gen, | 555 StatsProcessor::StatsProcessor(test::Random* rand_gen, |
562 TestConfig* test_config, | 556 TestConfig* test_config, |
563 AudioProcessing* apm) | 557 AudioProcessing* apm) |
564 : rand_gen_(rand_gen), test_config_(test_config), apm_(apm) {} | 558 : rand_gen_(rand_gen), test_config_(test_config), apm_(apm) {} |
565 | 559 |
566 // Implements the callback functionality for the statistics | 560 // Implements the callback functionality for the statistics |
567 // collection thread. | 561 // collection thread. |
568 bool StatsProcessor::Process() { | 562 bool StatsProcessor::Process() { |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 DISABLED_AudioProcessingImplLockExtensive, | 1102 DISABLED_AudioProcessingImplLockExtensive, |
1109 AudioProcessingImplLockTest, | 1103 AudioProcessingImplLockTest, |
1110 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); | 1104 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); |
1111 | 1105 |
1112 INSTANTIATE_TEST_CASE_P( | 1106 INSTANTIATE_TEST_CASE_P( |
1113 DISABLED_AudioProcessingImplLockBrief, | 1107 DISABLED_AudioProcessingImplLockBrief, |
1114 AudioProcessingImplLockTest, | 1108 AudioProcessingImplLockTest, |
1115 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); | 1109 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); |
1116 | 1110 |
1117 } // namespace webrtc | 1111 } // namespace webrtc |
OLD | NEW |