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

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

Issue 1678813002: Moved the GainControlForNewAGC class to a separate file. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed threadchecker and introduced lock Created 4 years, 10 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 EXPECT_EQ(apm_->echo_cancellation()->is_enabled(), 593 EXPECT_EQ(apm_->echo_cancellation()->is_enabled(),
594 ((test_config_->aec_type != AecType::AecTurnedOff) && 594 ((test_config_->aec_type != AecType::AecTurnedOff) &&
595 (test_config_->aec_type != 595 (test_config_->aec_type !=
596 AecType::BasicWebRtcAecSettingsWithAecMobile))); 596 AecType::BasicWebRtcAecSettingsWithAecMobile)));
597 apm_->echo_cancellation()->stream_drift_samples(); 597 apm_->echo_cancellation()->stream_drift_samples();
598 EXPECT_EQ(apm_->echo_control_mobile()->is_enabled(), 598 EXPECT_EQ(apm_->echo_control_mobile()->is_enabled(),
599 (test_config_->aec_type != AecType::AecTurnedOff) && 599 (test_config_->aec_type != AecType::AecTurnedOff) &&
600 (test_config_->aec_type == 600 (test_config_->aec_type ==
601 AecType::BasicWebRtcAecSettingsWithAecMobile)); 601 AecType::BasicWebRtcAecSettingsWithAecMobile));
602 EXPECT_TRUE(apm_->gain_control()->is_enabled()); 602 EXPECT_TRUE(apm_->gain_control()->is_enabled());
603 apm_->gain_control()->stream_analog_level();
604 EXPECT_TRUE(apm_->noise_suppression()->is_enabled()); 603 EXPECT_TRUE(apm_->noise_suppression()->is_enabled());
605 604
606 // The below return values are not testable. 605 // The below return values are not testable.
607 apm_->noise_suppression()->speech_probability(); 606 apm_->noise_suppression()->speech_probability();
608 apm_->voice_detection()->is_enabled(); 607 apm_->voice_detection()->is_enabled();
609 608
610 return true; 609 return true;
611 } 610 }
612 611
613 const float CaptureProcessor::kCaptureInputFloatLevel = 0.03125f; 612 const float CaptureProcessor::kCaptureInputFloatLevel = 0.03125f;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 (frame_data_.output_number_of_channels == 1 705 (frame_data_.output_number_of_channels == 1
707 ? AudioProcessing::ChannelLayout::kMono 706 ? AudioProcessing::ChannelLayout::kMono
708 : AudioProcessing::ChannelLayout::kStereo); 707 : AudioProcessing::ChannelLayout::kStereo);
709 } 708 }
710 709
711 // Applies the capture side processing API call. 710 // Applies the capture side processing API call.
712 void CaptureProcessor::CallApmCaptureSide() { 711 void CaptureProcessor::CallApmCaptureSide() {
713 // Prepare a proper capture side processing API call input. 712 // Prepare a proper capture side processing API call input.
714 PrepareFrame(); 713 PrepareFrame();
715 714
716 // Set the stream delay 715 // Set the stream delay.
717 apm_->set_stream_delay_ms(30); 716 apm_->set_stream_delay_ms(30);
718 717
718 // Set the analog level.
719 apm_->gain_control()->set_stream_analog_level(80);
720
719 // Call the specified capture side API processing method. 721 // Call the specified capture side API processing method.
720 int result = AudioProcessing::kNoError; 722 int result = AudioProcessing::kNoError;
721 switch (test_config_->capture_api_function) { 723 switch (test_config_->capture_api_function) {
722 case CaptureApiImpl::ProcessStreamImpl1: 724 case CaptureApiImpl::ProcessStreamImpl1:
723 result = apm_->ProcessStream(&frame_data_.frame); 725 result = apm_->ProcessStream(&frame_data_.frame);
724 break; 726 break;
725 case CaptureApiImpl::ProcessStreamImpl2: 727 case CaptureApiImpl::ProcessStreamImpl2:
726 result = apm_->ProcessStream( 728 result = apm_->ProcessStream(
727 &frame_data_.input_frame[0], frame_data_.input_samples_per_channel, 729 &frame_data_.input_frame[0], frame_data_.input_samples_per_channel,
728 frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout, 730 frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout,
729 frame_data_.output_sample_rate_hz, frame_data_.output_channel_layout, 731 frame_data_.output_sample_rate_hz, frame_data_.output_channel_layout,
730 &frame_data_.output_frame[0]); 732 &frame_data_.output_frame[0]);
731 break; 733 break;
732 case CaptureApiImpl::ProcessStreamImpl3: 734 case CaptureApiImpl::ProcessStreamImpl3:
733 result = apm_->ProcessStream( 735 result = apm_->ProcessStream(
734 &frame_data_.input_frame[0], frame_data_.input_stream_config, 736 &frame_data_.input_frame[0], frame_data_.input_stream_config,
735 frame_data_.output_stream_config, &frame_data_.output_frame[0]); 737 frame_data_.output_stream_config, &frame_data_.output_frame[0]);
736 break; 738 break;
737 default: 739 default:
738 FAIL(); 740 FAIL();
739 } 741 }
740 742
743 // Retrieve the new analog level.
744 apm_->gain_control()->stream_analog_level();
745
741 // Check the return code for error. 746 // Check the return code for error.
742 ASSERT_EQ(AudioProcessing::kNoError, result); 747 ASSERT_EQ(AudioProcessing::kNoError, result);
743 } 748 }
744 749
745 // Applies any runtime capture APM API calls and audio stream characteristics 750 // Applies any runtime capture APM API calls and audio stream characteristics
746 // specified by the scheme for the test. 751 // specified by the scheme for the test.
747 void CaptureProcessor::ApplyRuntimeSettingScheme() { 752 void CaptureProcessor::ApplyRuntimeSettingScheme() {
748 const int capture_count_local = frame_counters_->GetCaptureCounter(); 753 const int capture_count_local = frame_counters_->GetCaptureCounter();
749 754
750 // Update the number of channels and sample rates for the input and output. 755 // Update the number of channels and sample rates for the input and output.
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 DISABLED_AudioProcessingImplLockExtensive, 1133 DISABLED_AudioProcessingImplLockExtensive,
1129 AudioProcessingImplLockTest, 1134 AudioProcessingImplLockTest,
1130 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); 1135 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs()));
1131 1136
1132 INSTANTIATE_TEST_CASE_P( 1137 INSTANTIATE_TEST_CASE_P(
1133 AudioProcessingImplLockBrief, 1138 AudioProcessingImplLockBrief,
1134 AudioProcessingImplLockTest, 1139 AudioProcessingImplLockTest,
1135 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); 1140 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs()));
1136 1141
1137 } // namespace webrtc 1142 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698