| 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 #include "webrtc/modules/audio_processing/audio_processing_impl.h" | 10 #include "webrtc/modules/audio_processing/audio_processing_impl.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Type of the render thread APM API call to use in the test. | 40 // Type of the render thread APM API call to use in the test. |
| 41 enum class ProcessorType { kRender, kCapture }; | 41 enum class ProcessorType { kRender, kCapture }; |
| 42 | 42 |
| 43 // Variant of APM processing settings to use in the test. | 43 // Variant of APM processing settings to use in the test. |
| 44 enum class SettingsType { | 44 enum class SettingsType { |
| 45 kDefaultApmDesktop, | 45 kDefaultApmDesktop, |
| 46 kDefaultApmMobile, | 46 kDefaultApmMobile, |
| 47 kDefaultApmDesktopAndBeamformer, | 47 kDefaultApmDesktopAndBeamformer, |
| 48 kDefaultApmDesktopAndIntelligibilityEnhancer, | 48 kDefaultApmDesktopAndIntelligibilityEnhancer, |
| 49 kAllSubmodulesTurnedOff, | 49 kAllSubmodulesTurnedOff, |
| 50 kDefaultDesktopApmWithoutDelayAgnostic, | 50 kDefaultApmDesktopWithoutDelayAgnostic, |
| 51 kDefaultDesktopApmWithoutExtendedFilter | 51 kDefaultApmDesktopWithoutExtendedFilter |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Variables related to the audio data and formats. | 54 // Variables related to the audio data and formats. |
| 55 struct AudioFrameData { | 55 struct AudioFrameData { |
| 56 explicit AudioFrameData(size_t max_frame_size) { | 56 explicit AudioFrameData(size_t max_frame_size) { |
| 57 // Set up the two-dimensional arrays needed for the APM API calls. | 57 // Set up the two-dimensional arrays needed for the APM API calls. |
| 58 input_framechannels.resize(2 * max_frame_size); | 58 input_framechannels.resize(2 * max_frame_size); |
| 59 input_frame.resize(2); | 59 input_frame.resize(2); |
| 60 input_frame[0] = &input_framechannels[0]; | 60 input_frame[0] = &input_framechannels[0]; |
| 61 input_frame[1] = &input_framechannels[max_frame_size]; | 61 input_frame[1] = &input_framechannels[max_frame_size]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 78 struct SimulationConfig { | 78 struct SimulationConfig { |
| 79 SimulationConfig(int sample_rate_hz, SettingsType simulation_settings) | 79 SimulationConfig(int sample_rate_hz, SettingsType simulation_settings) |
| 80 : sample_rate_hz(sample_rate_hz), | 80 : sample_rate_hz(sample_rate_hz), |
| 81 simulation_settings(simulation_settings) {} | 81 simulation_settings(simulation_settings) {} |
| 82 | 82 |
| 83 static std::vector<SimulationConfig> GenerateSimulationConfigs() { | 83 static std::vector<SimulationConfig> GenerateSimulationConfigs() { |
| 84 std::vector<SimulationConfig> simulation_configs; | 84 std::vector<SimulationConfig> simulation_configs; |
| 85 #ifndef WEBRTC_ANDROID | 85 #ifndef WEBRTC_ANDROID |
| 86 const SettingsType desktop_settings[] = { | 86 const SettingsType desktop_settings[] = { |
| 87 SettingsType::kDefaultApmDesktop, SettingsType::kAllSubmodulesTurnedOff, | 87 SettingsType::kDefaultApmDesktop, SettingsType::kAllSubmodulesTurnedOff, |
| 88 SettingsType::kDefaultDesktopApmWithoutDelayAgnostic, | 88 SettingsType::kDefaultApmDesktopWithoutDelayAgnostic, |
| 89 SettingsType::kDefaultDesktopApmWithoutExtendedFilter}; | 89 SettingsType::kDefaultApmDesktopWithoutExtendedFilter}; |
| 90 | 90 |
| 91 const int desktop_sample_rates[] = {8000, 16000, 32000, 48000}; | 91 const int desktop_sample_rates[] = {8000, 16000, 32000, 48000}; |
| 92 | 92 |
| 93 for (auto sample_rate : desktop_sample_rates) { | 93 for (auto sample_rate : desktop_sample_rates) { |
| 94 for (auto settings : desktop_settings) { | 94 for (auto settings : desktop_settings) { |
| 95 simulation_configs.push_back(SimulationConfig(sample_rate, settings)); | 95 simulation_configs.push_back(SimulationConfig(sample_rate, settings)); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 const SettingsType intelligibility_enhancer_settings[] = { | 99 const SettingsType intelligibility_enhancer_settings[] = { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 break; | 144 break; |
| 145 case SettingsType::kDefaultApmDesktopAndBeamformer: | 145 case SettingsType::kDefaultApmDesktopAndBeamformer: |
| 146 description = "DefaultApmDesktopAndBeamformer"; | 146 description = "DefaultApmDesktopAndBeamformer"; |
| 147 break; | 147 break; |
| 148 case SettingsType::kDefaultApmDesktopAndIntelligibilityEnhancer: | 148 case SettingsType::kDefaultApmDesktopAndIntelligibilityEnhancer: |
| 149 description = "DefaultApmDesktopAndIntelligibilityEnhancer"; | 149 description = "DefaultApmDesktopAndIntelligibilityEnhancer"; |
| 150 break; | 150 break; |
| 151 case SettingsType::kAllSubmodulesTurnedOff: | 151 case SettingsType::kAllSubmodulesTurnedOff: |
| 152 description = "AllSubmodulesOff"; | 152 description = "AllSubmodulesOff"; |
| 153 break; | 153 break; |
| 154 case SettingsType::kDefaultDesktopApmWithoutDelayAgnostic: | 154 case SettingsType::kDefaultApmDesktopWithoutDelayAgnostic: |
| 155 description = "DefaultDesktopApmWithoutDelayAgnostic"; | 155 description = "DefaultApmDesktopWithoutDelayAgnostic"; |
| 156 break; | 156 break; |
| 157 case SettingsType::kDefaultDesktopApmWithoutExtendedFilter: | 157 case SettingsType::kDefaultApmDesktopWithoutExtendedFilter: |
| 158 description = "DefaultDesktopApmWithoutExtendedFilter"; | 158 description = "DefaultApmDesktopWithoutExtendedFilter"; |
| 159 break; | 159 break; |
| 160 } | 160 } |
| 161 return description; | 161 return description; |
| 162 } | 162 } |
| 163 | 163 |
| 164 int sample_rate_hz = 16000; | 164 int sample_rate_hz = 16000; |
| 165 SettingsType simulation_settings = SettingsType::kDefaultApmDesktop; | 165 SettingsType simulation_settings = SettingsType::kDefaultApmDesktop; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 // Handler for the frame counters. | 168 // Handler for the frame counters. |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 set_default_desktop_apm_runtime_settings(apm_.get()); | 598 set_default_desktop_apm_runtime_settings(apm_.get()); |
| 599 apm_->SetExtraOptions(config); | 599 apm_->SetExtraOptions(config); |
| 600 break; | 600 break; |
| 601 } | 601 } |
| 602 case SettingsType::kAllSubmodulesTurnedOff: { | 602 case SettingsType::kAllSubmodulesTurnedOff: { |
| 603 apm_.reset(AudioProcessingImpl::Create()); | 603 apm_.reset(AudioProcessingImpl::Create()); |
| 604 ASSERT_TRUE(!!apm_); | 604 ASSERT_TRUE(!!apm_); |
| 605 turn_off_default_apm_runtime_settings(apm_.get()); | 605 turn_off_default_apm_runtime_settings(apm_.get()); |
| 606 break; | 606 break; |
| 607 } | 607 } |
| 608 case SettingsType::kDefaultDesktopApmWithoutDelayAgnostic: { | 608 case SettingsType::kDefaultApmDesktopWithoutDelayAgnostic: { |
| 609 Config config; | 609 Config config; |
| 610 config.Set<ExtendedFilter>(new ExtendedFilter(true)); | 610 config.Set<ExtendedFilter>(new ExtendedFilter(true)); |
| 611 config.Set<DelayAgnostic>(new DelayAgnostic(false)); | 611 config.Set<DelayAgnostic>(new DelayAgnostic(false)); |
| 612 apm_.reset(AudioProcessingImpl::Create(config)); | 612 apm_.reset(AudioProcessingImpl::Create(config)); |
| 613 ASSERT_TRUE(!!apm_); | 613 ASSERT_TRUE(!!apm_); |
| 614 set_default_desktop_apm_runtime_settings(apm_.get()); | 614 set_default_desktop_apm_runtime_settings(apm_.get()); |
| 615 apm_->SetExtraOptions(config); | 615 apm_->SetExtraOptions(config); |
| 616 break; | 616 break; |
| 617 } | 617 } |
| 618 case SettingsType::kDefaultDesktopApmWithoutExtendedFilter: { | 618 case SettingsType::kDefaultApmDesktopWithoutExtendedFilter: { |
| 619 Config config; | 619 Config config; |
| 620 config.Set<ExtendedFilter>(new ExtendedFilter(false)); | 620 config.Set<ExtendedFilter>(new ExtendedFilter(false)); |
| 621 config.Set<DelayAgnostic>(new DelayAgnostic(true)); | 621 config.Set<DelayAgnostic>(new DelayAgnostic(true)); |
| 622 apm_.reset(AudioProcessingImpl::Create(config)); | 622 apm_.reset(AudioProcessingImpl::Create(config)); |
| 623 ASSERT_TRUE(!!apm_); | 623 ASSERT_TRUE(!!apm_); |
| 624 set_default_desktop_apm_runtime_settings(apm_.get()); | 624 set_default_desktop_apm_runtime_settings(apm_.get()); |
| 625 apm_->SetExtraOptions(config); | 625 apm_->SetExtraOptions(config); |
| 626 break; | 626 break; |
| 627 } | 627 } |
| 628 } | 628 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 // Run test and verify that it did not time out. | 708 // Run test and verify that it did not time out. |
| 709 EXPECT_EQ(kEventSignaled, Run()); | 709 EXPECT_EQ(kEventSignaled, Run()); |
| 710 } | 710 } |
| 711 | 711 |
| 712 INSTANTIATE_TEST_CASE_P( | 712 INSTANTIATE_TEST_CASE_P( |
| 713 AudioProcessingPerformanceTest, | 713 AudioProcessingPerformanceTest, |
| 714 CallSimulator, | 714 CallSimulator, |
| 715 ::testing::ValuesIn(SimulationConfig::GenerateSimulationConfigs())); | 715 ::testing::ValuesIn(SimulationConfig::GenerateSimulationConfigs())); |
| 716 | 716 |
| 717 } // namespace webrtc | 717 } // namespace webrtc |
| OLD | NEW |