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 1678813002: Moved the GainControlForNewAGC class to a separate file. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changed the locking test to match how the gain control is used in practice and to comply with the n… 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 EXPECT_EQ(apm_->echo_cancellation()->is_enabled(), 589 EXPECT_EQ(apm_->echo_cancellation()->is_enabled(),
590 ((test_config_->aec_type != AecType::AecTurnedOff) && 590 ((test_config_->aec_type != AecType::AecTurnedOff) &&
591 (test_config_->aec_type != 591 (test_config_->aec_type !=
592 AecType::BasicWebRtcAecSettingsWithAecMobile))); 592 AecType::BasicWebRtcAecSettingsWithAecMobile)));
593 apm_->echo_cancellation()->stream_drift_samples(); 593 apm_->echo_cancellation()->stream_drift_samples();
594 EXPECT_EQ(apm_->echo_control_mobile()->is_enabled(), 594 EXPECT_EQ(apm_->echo_control_mobile()->is_enabled(),
595 (test_config_->aec_type != AecType::AecTurnedOff) && 595 (test_config_->aec_type != AecType::AecTurnedOff) &&
596 (test_config_->aec_type == 596 (test_config_->aec_type ==
597 AecType::BasicWebRtcAecSettingsWithAecMobile)); 597 AecType::BasicWebRtcAecSettingsWithAecMobile));
598 EXPECT_TRUE(apm_->gain_control()->is_enabled()); 598 EXPECT_TRUE(apm_->gain_control()->is_enabled());
599 apm_->gain_control()->stream_analog_level();
600 EXPECT_TRUE(apm_->noise_suppression()->is_enabled()); 599 EXPECT_TRUE(apm_->noise_suppression()->is_enabled());
601 600
602 // The below return values are not testable. 601 // The below return values are not testable.
603 apm_->noise_suppression()->speech_probability(); 602 apm_->noise_suppression()->speech_probability();
604 apm_->voice_detection()->is_enabled(); 603 apm_->voice_detection()->is_enabled();
605 604
606 return true; 605 return true;
607 } 606 }
608 607
609 const float CaptureProcessor::kCaptureInputFloatLevel = 0.03125f; 608 const float CaptureProcessor::kCaptureInputFloatLevel = 0.03125f;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 (frame_data_.output_number_of_channels == 1 701 (frame_data_.output_number_of_channels == 1
703 ? AudioProcessing::ChannelLayout::kMono 702 ? AudioProcessing::ChannelLayout::kMono
704 : AudioProcessing::ChannelLayout::kStereo); 703 : AudioProcessing::ChannelLayout::kStereo);
705 } 704 }
706 705
707 // Applies the capture side processing API call. 706 // Applies the capture side processing API call.
708 void CaptureProcessor::CallApmCaptureSide() { 707 void CaptureProcessor::CallApmCaptureSide() {
709 // Prepare a proper capture side processing API call input. 708 // Prepare a proper capture side processing API call input.
710 PrepareFrame(); 709 PrepareFrame();
711 710
712 // Set the stream delay 711 // Set the stream delay.
713 apm_->set_stream_delay_ms(30); 712 apm_->set_stream_delay_ms(30);
714 713
714 // Set the analog level.
715 apm_->gain_control()->set_stream_analog_level(80);
716
715 // Call the specified capture side API processing method. 717 // Call the specified capture side API processing method.
716 int result = AudioProcessing::kNoError; 718 int result = AudioProcessing::kNoError;
717 switch (test_config_->capture_api_function) { 719 switch (test_config_->capture_api_function) {
718 case CaptureApiImpl::ProcessStreamImpl1: 720 case CaptureApiImpl::ProcessStreamImpl1:
719 result = apm_->ProcessStream(&frame_data_.frame); 721 result = apm_->ProcessStream(&frame_data_.frame);
720 break; 722 break;
721 case CaptureApiImpl::ProcessStreamImpl2: 723 case CaptureApiImpl::ProcessStreamImpl2:
722 result = apm_->ProcessStream( 724 result = apm_->ProcessStream(
723 &frame_data_.input_frame[0], frame_data_.input_samples_per_channel, 725 &frame_data_.input_frame[0], frame_data_.input_samples_per_channel,
724 frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout, 726 frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout,
725 frame_data_.output_sample_rate_hz, frame_data_.output_channel_layout, 727 frame_data_.output_sample_rate_hz, frame_data_.output_channel_layout,
726 &frame_data_.output_frame[0]); 728 &frame_data_.output_frame[0]);
727 break; 729 break;
728 case CaptureApiImpl::ProcessStreamImpl3: 730 case CaptureApiImpl::ProcessStreamImpl3:
729 result = apm_->ProcessStream( 731 result = apm_->ProcessStream(
730 &frame_data_.input_frame[0], frame_data_.input_stream_config, 732 &frame_data_.input_frame[0], frame_data_.input_stream_config,
731 frame_data_.output_stream_config, &frame_data_.output_frame[0]); 733 frame_data_.output_stream_config, &frame_data_.output_frame[0]);
732 break; 734 break;
733 default: 735 default:
734 FAIL(); 736 FAIL();
735 } 737 }
736 738
739 // Retrieve the new analog level.
740 apm_->gain_control()->stream_analog_level();
the sun 2016/02/09 11:49:55 Just for testing? It's a bit confusing that you sa
peah-webrtc 2016/02/10 09:33:37 The problem with that is that the purpose is not a
741
737 // Check the return code for error. 742 // Check the return code for error.
738 ASSERT_EQ(AudioProcessing::kNoError, result); 743 ASSERT_EQ(AudioProcessing::kNoError, result);
739 } 744 }
740 745
741 // Applies any runtime capture APM API calls and audio stream characteristics 746 // Applies any runtime capture APM API calls and audio stream characteristics
742 // specified by the scheme for the test. 747 // specified by the scheme for the test.
743 void CaptureProcessor::ApplyRuntimeSettingScheme() { 748 void CaptureProcessor::ApplyRuntimeSettingScheme() {
744 const int capture_count_local = frame_counters_->GetCaptureCounter(); 749 const int capture_count_local = frame_counters_->GetCaptureCounter();
745 750
746 // Update the number of channels and sample rates for the input and output. 751 // 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
1124 DISABLED_AudioProcessingImplLockExtensive, 1129 DISABLED_AudioProcessingImplLockExtensive,
1125 AudioProcessingImplLockTest, 1130 AudioProcessingImplLockTest,
1126 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); 1131 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs()));
1127 1132
1128 INSTANTIATE_TEST_CASE_P( 1133 INSTANTIATE_TEST_CASE_P(
1129 AudioProcessingImplLockBrief, 1134 AudioProcessingImplLockBrief,
1130 AudioProcessingImplLockTest, 1135 AudioProcessingImplLockTest,
1131 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); 1136 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs()));
1132 1137
1133 } // namespace webrtc 1138 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698