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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc

Issue 1424663003: Lock scheme #8: Introduced the new locking scheme (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@add_threadcheckers_CL
Patch Set: Created a threadsafe wrapper for the random generator in the locktest. Fixed an unprotected variabl… Created 5 years 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 12 matching lines...) Expand all
23 #include "webrtc/system_wrappers/include/event_wrapper.h" 23 #include "webrtc/system_wrappers/include/event_wrapper.h"
24 #include "webrtc/system_wrappers/include/sleep.h" 24 #include "webrtc/system_wrappers/include/sleep.h"
25 #include "webrtc/test/random.h" 25 #include "webrtc/test/random.h"
26 26
27 namespace webrtc { 27 namespace webrtc {
28 28
29 namespace { 29 namespace {
30 30
31 class AudioProcessingImplLockTest; 31 class AudioProcessingImplLockTest;
32 32
33 // Sleeps a random time between 0 and max_sleep milliseconds.
34 void SleepRandomMs(int max_sleep, test::Random* rand_gen) {
35 int sleeptime = rand_gen->Rand(0, max_sleep);
36 SleepMs(sleeptime);
37 }
38
39 // Populates a float audio frame with random data.
40 void PopulateAudioFrame(float** frame,
41 float amplitude,
42 size_t num_channels,
43 size_t samples_per_channel,
44 test::Random* rand_gen) {
45 for (size_t ch = 0; ch < num_channels; ch++) {
46 for (size_t k = 0; k < samples_per_channel; k++) {
47 // Store random 16 bit quantized float number between +-amplitude.
48 frame[ch][k] = amplitude * (2 * rand_gen->Rand<float>() - 1);
49 }
50 }
51 }
52
53 // Populates an audioframe frame of AudioFrame type with random data.
54 void PopulateAudioFrame(AudioFrame* frame,
55 int16_t amplitude,
56 test::Random* rand_gen) {
57 ASSERT_GT(amplitude, 0);
58 ASSERT_LE(amplitude, 32767);
59 for (int ch = 0; ch < frame->num_channels_; ch++) {
60 for (int k = 0; k < static_cast<int>(frame->samples_per_channel_); k++) {
61 // Store random 16 bit number between -(amplitude+1) and
62 // amplitude.
63 frame->data_[k * ch] = rand_gen->Rand(2 * amplitude + 1) - amplitude - 1;
64 }
65 }
66 }
67
68 // Type of the render thread APM API call to use in the test. 33 // Type of the render thread APM API call to use in the test.
69 enum class RenderApiImpl { 34 enum class RenderApiImpl {
70 ProcessReverseStreamImpl1, 35 ProcessReverseStreamImpl1,
71 ProcessReverseStreamImpl2, 36 ProcessReverseStreamImpl2,
72 AnalyzeReverseStreamImpl1, 37 AnalyzeReverseStreamImpl1,
73 AnalyzeReverseStreamImpl2 38 AnalyzeReverseStreamImpl2
74 }; 39 };
75 40
76 // Type of the capture thread APM API call to use in the test. 41 // Type of the capture thread APM API call to use in the test.
77 enum class CaptureApiImpl { 42 enum class CaptureApiImpl {
(...skipping 12 matching lines...) Expand all
90 55
91 // Variant of echo canceller settings to use in the test. 56 // Variant of echo canceller settings to use in the test.
92 enum class AecType { 57 enum class AecType {
93 BasicWebRtcAecSettings, 58 BasicWebRtcAecSettings,
94 AecTurnedOff, 59 AecTurnedOff,
95 BasicWebRtcAecSettingsWithExtentedFilter, 60 BasicWebRtcAecSettingsWithExtentedFilter,
96 BasicWebRtcAecSettingsWithDelayAgnosticAec, 61 BasicWebRtcAecSettingsWithDelayAgnosticAec,
97 BasicWebRtcAecSettingsWithAecMobile 62 BasicWebRtcAecSettingsWithAecMobile
98 }; 63 };
99 64
65 // Thread-safe random number generator wrapper.
66 class RandomGenerator {
67 public:
68 RandomGenerator() : rand_gen_(42U) {}
69
70 int RandInt(int min, int max) {
71 rtc::CritScope cs(&crit_);
72 return rand_gen_.Rand(min, max);
73 }
74
75 int RandInt(int max) {
76 rtc::CritScope cs(&crit_);
77 return rand_gen_.Rand(max);
78 }
79
80 float RandFloat() {
81 rtc::CritScope cs(&crit_);
82 return rand_gen_.Rand<float>();
83 }
84
85 private:
86 rtc::CriticalSection crit_;
87 test::Random rand_gen_ GUARDED_BY(crit_);
88 };
89
100 // Variables related to the audio data and formats. 90 // Variables related to the audio data and formats.
101 struct AudioFrameData { 91 struct AudioFrameData {
102 explicit AudioFrameData(int max_frame_size) { 92 explicit AudioFrameData(int max_frame_size) {
103 // Set up the two-dimensional arrays needed for the APM API calls. 93 // Set up the two-dimensional arrays needed for the APM API calls.
104 input_framechannels.resize(2 * max_frame_size); 94 input_framechannels.resize(2 * max_frame_size);
105 input_frame.resize(2); 95 input_frame.resize(2);
106 input_frame[0] = &input_framechannels[0]; 96 input_frame[0] = &input_framechannels[0];
107 input_frame[1] = &input_framechannels[max_frame_size]; 97 input_frame[1] = &input_framechannels[max_frame_size];
108 98
109 output_frame_channels.resize(2 * max_frame_size); 99 output_frame_channels.resize(2 * max_frame_size);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 314
325 private: 315 private:
326 rtc::CriticalSection crit_; 316 rtc::CriticalSection crit_;
327 bool capture_side_called_ GUARDED_BY(crit_) = false; 317 bool capture_side_called_ GUARDED_BY(crit_) = false;
328 }; 318 };
329 319
330 // Class for handling the capture side processing. 320 // Class for handling the capture side processing.
331 class CaptureProcessor { 321 class CaptureProcessor {
332 public: 322 public:
333 CaptureProcessor(int max_frame_size, 323 CaptureProcessor(int max_frame_size,
334 test::Random* rand_gen, 324 RandomGenerator* rand_gen,
335 FrameCounters* shared_counters_state, 325 FrameCounters* shared_counters_state,
336 CaptureSideCalledChecker* capture_call_checker, 326 CaptureSideCalledChecker* capture_call_checker,
337 AudioProcessingImplLockTest* test_framework, 327 AudioProcessingImplLockTest* test_framework,
338 TestConfig* test_config, 328 TestConfig* test_config,
339 AudioProcessing* apm); 329 AudioProcessing* apm);
340 bool Process(); 330 bool Process();
341 331
342 private: 332 private:
343 static const int kMaxCallDifference = 10; 333 static const int kMaxCallDifference = 10;
344 static const float kCaptureInputFloatLevel; 334 static const float kCaptureInputFloatLevel;
345 static const int kCaptureInputFixLevel = 1024; 335 static const int kCaptureInputFixLevel = 1024;
346 336
347 void PrepareFrame(); 337 void PrepareFrame();
348 void CallApmCaptureSide(); 338 void CallApmCaptureSide();
349 void ApplyRuntimeSettingScheme(); 339 void ApplyRuntimeSettingScheme();
350 340
351 test::Random* rand_gen_ = nullptr; 341 RandomGenerator* rand_gen_ = nullptr;
352 FrameCounters* frame_counters_ = nullptr; 342 FrameCounters* frame_counters_ = nullptr;
353 CaptureSideCalledChecker* capture_call_checker_ = nullptr; 343 CaptureSideCalledChecker* capture_call_checker_ = nullptr;
354 AudioProcessingImplLockTest* test_ = nullptr; 344 AudioProcessingImplLockTest* test_ = nullptr;
355 TestConfig* test_config_ = nullptr; 345 TestConfig* test_config_ = nullptr;
356 AudioProcessing* apm_ = nullptr; 346 AudioProcessing* apm_ = nullptr;
357 AudioFrameData frame_data_; 347 AudioFrameData frame_data_;
358 }; 348 };
359 349
360 // Class for handling the stats processing. 350 // Class for handling the stats processing.
361 class StatsProcessor { 351 class StatsProcessor {
362 public: 352 public:
363 StatsProcessor(test::Random* rand_gen, 353 StatsProcessor(RandomGenerator* rand_gen,
364 TestConfig* test_config, 354 TestConfig* test_config,
365 AudioProcessing* apm); 355 AudioProcessing* apm);
366 bool Process(); 356 bool Process();
367 357
368 private: 358 private:
369 test::Random* rand_gen_ = nullptr; 359 RandomGenerator* rand_gen_ = nullptr;
370 TestConfig* test_config_ = nullptr; 360 TestConfig* test_config_ = nullptr;
371 AudioProcessing* apm_ = nullptr; 361 AudioProcessing* apm_ = nullptr;
372 }; 362 };
373 363
374 // Class for handling the render side processing. 364 // Class for handling the render side processing.
375 class RenderProcessor { 365 class RenderProcessor {
376 public: 366 public:
377 RenderProcessor(int max_frame_size, 367 RenderProcessor(int max_frame_size,
378 test::Random* rand_gen, 368 RandomGenerator* rand_gen,
379 FrameCounters* shared_counters_state, 369 FrameCounters* shared_counters_state,
380 CaptureSideCalledChecker* capture_call_checker, 370 CaptureSideCalledChecker* capture_call_checker,
381 AudioProcessingImplLockTest* test_framework, 371 AudioProcessingImplLockTest* test_framework,
382 TestConfig* test_config, 372 TestConfig* test_config,
383 AudioProcessing* apm); 373 AudioProcessing* apm);
384 bool Process(); 374 bool Process();
385 375
386 private: 376 private:
387 static const int kMaxCallDifference = 10; 377 static const int kMaxCallDifference = 10;
388 static const int kRenderInputFixLevel = 16384; 378 static const int kRenderInputFixLevel = 16384;
389 static const float kRenderInputFloatLevel; 379 static const float kRenderInputFloatLevel;
390 380
391 void PrepareFrame(); 381 void PrepareFrame();
392 void CallApmRenderSide(); 382 void CallApmRenderSide();
393 void ApplyRuntimeSettingScheme(); 383 void ApplyRuntimeSettingScheme();
394 384
395 test::Random* rand_gen_ = nullptr; 385 RandomGenerator* rand_gen_ = nullptr;
396 FrameCounters* frame_counters_ = nullptr; 386 FrameCounters* frame_counters_ = nullptr;
397 CaptureSideCalledChecker* capture_call_checker_ = nullptr; 387 CaptureSideCalledChecker* capture_call_checker_ = nullptr;
398 AudioProcessingImplLockTest* test_ = nullptr; 388 AudioProcessingImplLockTest* test_ = nullptr;
399 TestConfig* test_config_ = nullptr; 389 TestConfig* test_config_ = nullptr;
400 AudioProcessing* apm_ = nullptr; 390 AudioProcessing* apm_ = nullptr;
401 bool first_render_side_call_ = true; 391 bool first_render_side_call_ = true;
402 AudioFrameData frame_data_; 392 AudioFrameData frame_data_;
403 }; 393 };
404 394
405 class AudioProcessingImplLockTest 395 class AudioProcessingImplLockTest
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 stats_thread_.SetPriority(rtc::kNormalPriority); 442 stats_thread_.SetPriority(rtc::kNormalPriority);
453 } 443 }
454 444
455 // Event handler for the test. 445 // Event handler for the test.
456 const rtc::scoped_ptr<EventWrapper> test_complete_; 446 const rtc::scoped_ptr<EventWrapper> test_complete_;
457 447
458 // Thread related variables. 448 // Thread related variables.
459 rtc::PlatformThread render_thread_; 449 rtc::PlatformThread render_thread_;
460 rtc::PlatformThread capture_thread_; 450 rtc::PlatformThread capture_thread_;
461 rtc::PlatformThread stats_thread_; 451 rtc::PlatformThread stats_thread_;
462 mutable test::Random rand_gen_; 452 mutable RandomGenerator rand_gen_;
463 453
464 rtc::scoped_ptr<AudioProcessing> apm_; 454 rtc::scoped_ptr<AudioProcessing> apm_;
465 TestConfig test_config_; 455 TestConfig test_config_;
466 FrameCounters frame_counters_; 456 FrameCounters frame_counters_;
467 CaptureSideCalledChecker capture_call_checker_; 457 CaptureSideCalledChecker capture_call_checker_;
468 RenderProcessor render_thread_state_; 458 RenderProcessor render_thread_state_;
469 CaptureProcessor capture_thread_state_; 459 CaptureProcessor capture_thread_state_;
470 StatsProcessor stats_thread_state_; 460 StatsProcessor stats_thread_state_;
471 }; 461 };
472 462
463 // Sleeps a random time between 0 and max_sleep milliseconds.
464 void SleepRandomMs(int max_sleep, RandomGenerator* rand_gen) {
465 int sleeptime = rand_gen->RandInt(0, max_sleep);
466 SleepMs(sleeptime);
467 }
468
469 // Populates a float audio frame with random data.
470 void PopulateAudioFrame(float** frame,
471 float amplitude,
472 size_t num_channels,
473 size_t samples_per_channel,
474 RandomGenerator* rand_gen) {
475 for (size_t ch = 0; ch < num_channels; ch++) {
476 for (size_t k = 0; k < samples_per_channel; k++) {
477 // Store random 16 bit quantized float number between +-amplitude.
478 frame[ch][k] = amplitude * (2 * rand_gen->RandFloat() - 1);
479 }
480 }
481 }
482
483 // Populates an audioframe frame of AudioFrame type with random data.
484 void PopulateAudioFrame(AudioFrame* frame,
485 int16_t amplitude,
486 RandomGenerator* rand_gen) {
487 ASSERT_GT(amplitude, 0);
488 ASSERT_LE(amplitude, 32767);
489 for (int ch = 0; ch < frame->num_channels_; ch++) {
490 for (int k = 0; k < static_cast<int>(frame->samples_per_channel_); k++) {
491 // Store random 16 bit number between -(amplitude+1) and
492 // amplitude.
493 frame->data_[k * ch] =
494 rand_gen->RandInt(2 * amplitude + 1) - amplitude - 1;
495 }
496 }
497 }
498
473 AudioProcessingImplLockTest::AudioProcessingImplLockTest() 499 AudioProcessingImplLockTest::AudioProcessingImplLockTest()
474 : test_complete_(EventWrapper::Create()), 500 : test_complete_(EventWrapper::Create()),
475 render_thread_(RenderProcessorThreadFunc, this, "render"), 501 render_thread_(RenderProcessorThreadFunc, this, "render"),
476 capture_thread_(CaptureProcessorThreadFunc, this, "capture"), 502 capture_thread_(CaptureProcessorThreadFunc, this, "capture"),
477 stats_thread_(StatsProcessorThreadFunc, this, "stats"), 503 stats_thread_(StatsProcessorThreadFunc, this, "stats"),
478 rand_gen_(42U),
479 apm_(AudioProcessingImpl::Create()), 504 apm_(AudioProcessingImpl::Create()),
480 render_thread_state_(kMaxFrameSize, 505 render_thread_state_(kMaxFrameSize,
481 &rand_gen_, 506 &rand_gen_,
482 &frame_counters_, 507 &frame_counters_,
483 &capture_call_checker_, 508 &capture_call_checker_,
484 this, 509 this,
485 &test_config_, 510 &test_config_,
486 apm_.get()), 511 apm_.get()),
487 capture_thread_state_(kMaxFrameSize, 512 capture_thread_state_(kMaxFrameSize,
488 &rand_gen_, 513 &rand_gen_,
(...skipping 17 matching lines...) Expand all
506 } 531 }
507 532
508 // Setup of test and APM. 533 // Setup of test and APM.
509 void AudioProcessingImplLockTest::SetUp() { 534 void AudioProcessingImplLockTest::SetUp() {
510 test_config_ = static_cast<TestConfig>(GetParam()); 535 test_config_ = static_cast<TestConfig>(GetParam());
511 536
512 ASSERT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true)); 537 ASSERT_EQ(apm_->kNoError, apm_->level_estimator()->Enable(true));
513 ASSERT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true)); 538 ASSERT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
514 539
515 ASSERT_EQ(apm_->kNoError, 540 ASSERT_EQ(apm_->kNoError,
516 apm_->gain_control()->set_mode(GainControl::kAdaptiveAnalog)); 541 apm_->gain_control()->set_mode(GainControl::kAdaptiveDigital));
517 ASSERT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true)); 542 ASSERT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
518 543
519 ASSERT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(true)); 544 ASSERT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(true));
520 ASSERT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(true)); 545 ASSERT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(true));
521 546
522 Config config; 547 Config config;
523 if (test_config_.aec_type == AecType::AecTurnedOff) { 548 if (test_config_.aec_type == AecType::AecTurnedOff) {
524 ASSERT_EQ(apm_->kNoError, apm_->echo_control_mobile()->Enable(false)); 549 ASSERT_EQ(apm_->kNoError, apm_->echo_control_mobile()->Enable(false));
525 ASSERT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(false)); 550 ASSERT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(false));
526 } else if (test_config_.aec_type == 551 } else if (test_config_.aec_type ==
(...skipping 18 matching lines...) Expand all
545 apm_->SetExtraOptions(config); 570 apm_->SetExtraOptions(config);
546 } 571 }
547 } 572 }
548 573
549 void AudioProcessingImplLockTest::TearDown() { 574 void AudioProcessingImplLockTest::TearDown() {
550 render_thread_.Stop(); 575 render_thread_.Stop();
551 capture_thread_.Stop(); 576 capture_thread_.Stop();
552 stats_thread_.Stop(); 577 stats_thread_.Stop();
553 } 578 }
554 579
555 StatsProcessor::StatsProcessor(test::Random* rand_gen, 580 StatsProcessor::StatsProcessor(RandomGenerator* rand_gen,
556 TestConfig* test_config, 581 TestConfig* test_config,
557 AudioProcessing* apm) 582 AudioProcessing* apm)
558 : rand_gen_(rand_gen), test_config_(test_config), apm_(apm) {} 583 : rand_gen_(rand_gen), test_config_(test_config), apm_(apm) {}
559 584
560 // Implements the callback functionality for the statistics 585 // Implements the callback functionality for the statistics
561 // collection thread. 586 // collection thread.
562 bool StatsProcessor::Process() { 587 bool StatsProcessor::Process() {
563 SleepRandomMs(100, rand_gen_); 588 SleepRandomMs(100, rand_gen_);
564 589
565 EXPECT_EQ(apm_->echo_cancellation()->is_enabled(), 590 EXPECT_EQ(apm_->echo_cancellation()->is_enabled(),
(...skipping 13 matching lines...) Expand all
579 apm_->noise_suppression()->speech_probability(); 604 apm_->noise_suppression()->speech_probability();
580 apm_->voice_detection()->is_enabled(); 605 apm_->voice_detection()->is_enabled();
581 606
582 return true; 607 return true;
583 } 608 }
584 609
585 const float CaptureProcessor::kCaptureInputFloatLevel = 0.03125f; 610 const float CaptureProcessor::kCaptureInputFloatLevel = 0.03125f;
586 611
587 CaptureProcessor::CaptureProcessor( 612 CaptureProcessor::CaptureProcessor(
588 int max_frame_size, 613 int max_frame_size,
589 test::Random* rand_gen, 614 RandomGenerator* rand_gen,
590 FrameCounters* shared_counters_state, 615 FrameCounters* shared_counters_state,
591 CaptureSideCalledChecker* capture_call_checker, 616 CaptureSideCalledChecker* capture_call_checker,
592 AudioProcessingImplLockTest* test_framework, 617 AudioProcessingImplLockTest* test_framework,
593 TestConfig* test_config, 618 TestConfig* test_config,
594 AudioProcessing* apm) 619 AudioProcessing* apm)
595 : rand_gen_(rand_gen), 620 : rand_gen_(rand_gen),
596 frame_counters_(shared_counters_state), 621 frame_counters_(shared_counters_state),
597 capture_call_checker_(capture_call_checker), 622 capture_call_checker_(capture_call_checker),
598 test_(test_framework), 623 test_(test_framework),
599 test_config_(test_config), 624 test_config_(test_config),
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 case RuntimeParameterSettingScheme::FixedMonoStreamMetadataScheme: 842 case RuntimeParameterSettingScheme::FixedMonoStreamMetadataScheme:
818 break; 843 break;
819 case RuntimeParameterSettingScheme::ExtremeStreamMetadataChangeScheme: 844 case RuntimeParameterSettingScheme::ExtremeStreamMetadataChangeScheme:
820 case RuntimeParameterSettingScheme::FixedStereoStreamMetadataScheme: 845 case RuntimeParameterSettingScheme::FixedStereoStreamMetadataScheme:
821 if (capture_count_local % 2 == 0) { 846 if (capture_count_local % 2 == 0) {
822 ASSERT_EQ(AudioProcessing::Error::kNoError, 847 ASSERT_EQ(AudioProcessing::Error::kNoError,
823 apm_->set_stream_delay_ms(30)); 848 apm_->set_stream_delay_ms(30));
824 apm_->set_stream_key_pressed(true); 849 apm_->set_stream_key_pressed(true);
825 apm_->set_delay_offset_ms(15); 850 apm_->set_delay_offset_ms(15);
826 EXPECT_EQ(apm_->delay_offset_ms(), 15); 851 EXPECT_EQ(apm_->delay_offset_ms(), 15);
827 EXPECT_GE(apm_->num_reverse_channels(), 0);
828 EXPECT_LE(apm_->num_reverse_channels(), 2);
829 } else { 852 } else {
830 ASSERT_EQ(AudioProcessing::Error::kNoError, 853 ASSERT_EQ(AudioProcessing::Error::kNoError,
831 apm_->set_stream_delay_ms(50)); 854 apm_->set_stream_delay_ms(50));
832 apm_->set_stream_key_pressed(false); 855 apm_->set_stream_key_pressed(false);
833 apm_->set_delay_offset_ms(20); 856 apm_->set_delay_offset_ms(20);
834 EXPECT_EQ(apm_->delay_offset_ms(), 20); 857 EXPECT_EQ(apm_->delay_offset_ms(), 20);
835 apm_->delay_offset_ms(); 858 apm_->delay_offset_ms();
836 apm_->num_reverse_channels();
837 EXPECT_GE(apm_->num_reverse_channels(), 0);
838 EXPECT_LE(apm_->num_reverse_channels(), 2);
839 } 859 }
840 break; 860 break;
841 default: 861 default:
842 FAIL(); 862 FAIL();
843 } 863 }
844 864
845 // Restric the number of output channels not to exceed 865 // Restric the number of output channels not to exceed
846 // the number of input channels. 866 // the number of input channels.
847 frame_data_.output_number_of_channels = 867 frame_data_.output_number_of_channels =
848 std::min(frame_data_.output_number_of_channels, 868 std::min(frame_data_.output_number_of_channels,
849 frame_data_.input_number_of_channels); 869 frame_data_.input_number_of_channels);
850 } 870 }
851 871
852 const float RenderProcessor::kRenderInputFloatLevel = 0.5f; 872 const float RenderProcessor::kRenderInputFloatLevel = 0.5f;
853 873
854 RenderProcessor::RenderProcessor(int max_frame_size, 874 RenderProcessor::RenderProcessor(int max_frame_size,
855 test::Random* rand_gen, 875 RandomGenerator* rand_gen,
856 FrameCounters* shared_counters_state, 876 FrameCounters* shared_counters_state,
857 CaptureSideCalledChecker* capture_call_checker, 877 CaptureSideCalledChecker* capture_call_checker,
858 AudioProcessingImplLockTest* test_framework, 878 AudioProcessingImplLockTest* test_framework,
859 TestConfig* test_config, 879 TestConfig* test_config,
860 AudioProcessing* apm) 880 AudioProcessing* apm)
861 : rand_gen_(rand_gen), 881 : rand_gen_(rand_gen),
862 frame_counters_(shared_counters_state), 882 frame_counters_(shared_counters_state),
863 capture_call_checker_(capture_call_checker), 883 capture_call_checker_(capture_call_checker),
864 test_(test_framework), 884 test_(test_framework),
865 test_config_(test_config), 885 test_config_(test_config),
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 ASSERT_EQ(kEventSignaled, RunTest()); 1117 ASSERT_EQ(kEventSignaled, RunTest());
1098 } 1118 }
1099 1119
1100 // Instantiate tests from the extreme test configuration set. 1120 // Instantiate tests from the extreme test configuration set.
1101 INSTANTIATE_TEST_CASE_P( 1121 INSTANTIATE_TEST_CASE_P(
1102 DISABLED_AudioProcessingImplLockExtensive, 1122 DISABLED_AudioProcessingImplLockExtensive,
1103 AudioProcessingImplLockTest, 1123 AudioProcessingImplLockTest,
1104 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); 1124 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs()));
1105 1125
1106 INSTANTIATE_TEST_CASE_P( 1126 INSTANTIATE_TEST_CASE_P(
1107 DISABLED_AudioProcessingImplLockBrief, 1127 AudioProcessingImplLockBrief,
1108 AudioProcessingImplLockTest, 1128 AudioProcessingImplLockTest,
1109 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); 1129 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs()));
1110 1130
1111 } // namespace webrtc 1131 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/audio_processing_impl.cc ('k') | webrtc/modules/audio_processing/echo_cancellation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698