| 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 17 matching lines...) Expand all Loading... |
| 28 namespace webrtc { | 28 namespace webrtc { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class AudioProcessingImplLockTest; | 32 class AudioProcessingImplLockTest; |
| 33 | 33 |
| 34 // Type of the render thread APM API call to use in the test. | 34 // Type of the render thread APM API call to use in the test. |
| 35 enum class RenderApiImpl { | 35 enum class RenderApiImpl { |
| 36 ProcessReverseStreamImpl1, | 36 ProcessReverseStreamImpl1, |
| 37 ProcessReverseStreamImpl2, | 37 ProcessReverseStreamImpl2, |
| 38 AnalyzeReverseStreamImpl1, | 38 AnalyzeReverseStreamImpl |
| 39 AnalyzeReverseStreamImpl2 | |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 // 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. |
| 43 enum class CaptureApiImpl { | 42 enum class CaptureApiImpl { |
| 44 ProcessStreamImpl1, | 43 ProcessStreamImpl1, |
| 45 ProcessStreamImpl2, | 44 ProcessStreamImpl2, |
| 46 ProcessStreamImpl3 | 45 ProcessStreamImpl3 |
| 47 }; | 46 }; |
| 48 | 47 |
| 49 // The runtime parameter setting scheme to use in the test. | 48 // The runtime parameter setting scheme to use in the test. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 test_config.initial_sample_rate_hz = 16000; | 142 test_config.initial_sample_rate_hz = 16000; |
| 144 | 143 |
| 145 // Create test config for the second processing API function set. | 144 // Create test config for the second processing API function set. |
| 146 test_config.render_api_function = | 145 test_config.render_api_function = |
| 147 RenderApiImpl::ProcessReverseStreamImpl2; | 146 RenderApiImpl::ProcessReverseStreamImpl2; |
| 148 test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl2; | 147 test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl2; |
| 149 | 148 |
| 150 // Create test config for the first processing API function set. | 149 // Create test config for the first processing API function set. |
| 151 test_configs.push_back(test_config); | 150 test_configs.push_back(test_config); |
| 152 test_config.render_api_function = | 151 test_config.render_api_function = |
| 153 RenderApiImpl::AnalyzeReverseStreamImpl2; | 152 RenderApiImpl::AnalyzeReverseStreamImpl; |
| 154 test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl3; | 153 test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl3; |
| 155 test_configs.push_back(test_config); | 154 test_configs.push_back(test_config); |
| 156 } | 155 } |
| 157 | 156 |
| 158 // Return the created test configurations. | 157 // Return the created test configurations. |
| 159 return test_configs; | 158 return test_configs; |
| 160 } | 159 } |
| 161 | 160 |
| 162 // Test case generator for the test configurations to use in the extensive | 161 // Test case generator for the test configurations to use in the extensive |
| 163 // tests. | 162 // tests. |
| 164 static std::vector<TestConfig> GenerateExtensiveTestConfigs() { | 163 static std::vector<TestConfig> GenerateExtensiveTestConfigs() { |
| 165 // Lambda functions for the test config generation. | 164 // Lambda functions for the test config generation. |
| 166 auto add_processing_apis = [](TestConfig test_config) { | 165 auto add_processing_apis = [](TestConfig test_config) { |
| 167 struct AllowedApiCallCombinations { | 166 struct AllowedApiCallCombinations { |
| 168 RenderApiImpl render_api; | 167 RenderApiImpl render_api; |
| 169 CaptureApiImpl capture_api; | 168 CaptureApiImpl capture_api; |
| 170 }; | 169 }; |
| 171 | 170 |
| 172 const AllowedApiCallCombinations api_calls[] = { | 171 const AllowedApiCallCombinations api_calls[] = { |
| 173 {RenderApiImpl::ProcessReverseStreamImpl1, | 172 {RenderApiImpl::ProcessReverseStreamImpl1, |
| 174 CaptureApiImpl::ProcessStreamImpl1}, | 173 CaptureApiImpl::ProcessStreamImpl1}, |
| 175 {RenderApiImpl::AnalyzeReverseStreamImpl1, | |
| 176 CaptureApiImpl::ProcessStreamImpl1}, | |
| 177 {RenderApiImpl::ProcessReverseStreamImpl2, | 174 {RenderApiImpl::ProcessReverseStreamImpl2, |
| 178 CaptureApiImpl::ProcessStreamImpl2}, | 175 CaptureApiImpl::ProcessStreamImpl2}, |
| 179 {RenderApiImpl::ProcessReverseStreamImpl2, | 176 {RenderApiImpl::ProcessReverseStreamImpl2, |
| 180 CaptureApiImpl::ProcessStreamImpl3}, | 177 CaptureApiImpl::ProcessStreamImpl3}, |
| 181 {RenderApiImpl::AnalyzeReverseStreamImpl2, | 178 {RenderApiImpl::AnalyzeReverseStreamImpl, |
| 182 CaptureApiImpl::ProcessStreamImpl2}, | 179 CaptureApiImpl::ProcessStreamImpl2}, |
| 183 {RenderApiImpl::AnalyzeReverseStreamImpl2, | 180 {RenderApiImpl::AnalyzeReverseStreamImpl, |
| 184 CaptureApiImpl::ProcessStreamImpl3}}; | 181 CaptureApiImpl::ProcessStreamImpl3}}; |
| 185 std::vector<TestConfig> out; | 182 std::vector<TestConfig> out; |
| 186 for (auto api_call : api_calls) { | 183 for (auto api_call : api_calls) { |
| 187 test_config.render_api_function = api_call.render_api; | 184 test_config.render_api_function = api_call.render_api; |
| 188 test_config.capture_api_function = api_call.capture_api; | 185 test_config.capture_api_function = api_call.capture_api; |
| 189 out.push_back(test_config); | 186 out.push_back(test_config); |
| 190 } | 187 } |
| 191 return out; | 188 return out; |
| 192 }; | 189 }; |
| 193 | 190 |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 render_call_event_->Set(); | 931 render_call_event_->Set(); |
| 935 return true; | 932 return true; |
| 936 } | 933 } |
| 937 | 934 |
| 938 // Prepares the render side frame and the accompanying metadata | 935 // Prepares the render side frame and the accompanying metadata |
| 939 // with the appropriate information. | 936 // with the appropriate information. |
| 940 void RenderProcessor::PrepareFrame() { | 937 void RenderProcessor::PrepareFrame() { |
| 941 // Restrict to a common fixed sample rate if the AudioFrame interface is | 938 // Restrict to a common fixed sample rate if the AudioFrame interface is |
| 942 // used. | 939 // used. |
| 943 if ((test_config_->render_api_function == | 940 if ((test_config_->render_api_function == |
| 944 RenderApiImpl::AnalyzeReverseStreamImpl1) || | |
| 945 (test_config_->render_api_function == | |
| 946 RenderApiImpl::ProcessReverseStreamImpl1) || | 941 RenderApiImpl::ProcessReverseStreamImpl1) || |
| 947 (test_config_->aec_type != | 942 (test_config_->aec_type != |
| 948 AecType::BasicWebRtcAecSettingsWithAecMobile)) { | 943 AecType::BasicWebRtcAecSettingsWithAecMobile)) { |
| 949 frame_data_.input_sample_rate_hz = test_config_->initial_sample_rate_hz; | 944 frame_data_.input_sample_rate_hz = test_config_->initial_sample_rate_hz; |
| 950 frame_data_.output_sample_rate_hz = test_config_->initial_sample_rate_hz; | 945 frame_data_.output_sample_rate_hz = test_config_->initial_sample_rate_hz; |
| 951 } | 946 } |
| 952 | 947 |
| 953 // Prepare the audioframe data and metadata | 948 // Prepare the audioframe data and metadata |
| 954 frame_data_.input_samples_per_channel = | 949 frame_data_.input_samples_per_channel = |
| 955 frame_data_.input_sample_rate_hz * AudioProcessing::kChunkSizeMs / 1000; | 950 frame_data_.input_sample_rate_hz * AudioProcessing::kChunkSizeMs / 1000; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 int result = AudioProcessing::kNoError; | 991 int result = AudioProcessing::kNoError; |
| 997 switch (test_config_->render_api_function) { | 992 switch (test_config_->render_api_function) { |
| 998 case RenderApiImpl::ProcessReverseStreamImpl1: | 993 case RenderApiImpl::ProcessReverseStreamImpl1: |
| 999 result = apm_->ProcessReverseStream(&frame_data_.frame); | 994 result = apm_->ProcessReverseStream(&frame_data_.frame); |
| 1000 break; | 995 break; |
| 1001 case RenderApiImpl::ProcessReverseStreamImpl2: | 996 case RenderApiImpl::ProcessReverseStreamImpl2: |
| 1002 result = apm_->ProcessReverseStream( | 997 result = apm_->ProcessReverseStream( |
| 1003 &frame_data_.input_frame[0], frame_data_.input_stream_config, | 998 &frame_data_.input_frame[0], frame_data_.input_stream_config, |
| 1004 frame_data_.output_stream_config, &frame_data_.output_frame[0]); | 999 frame_data_.output_stream_config, &frame_data_.output_frame[0]); |
| 1005 break; | 1000 break; |
| 1006 case RenderApiImpl::AnalyzeReverseStreamImpl1: | 1001 case RenderApiImpl::AnalyzeReverseStreamImpl: |
| 1007 result = apm_->AnalyzeReverseStream(&frame_data_.frame); | |
| 1008 break; | |
| 1009 case RenderApiImpl::AnalyzeReverseStreamImpl2: | |
| 1010 result = apm_->AnalyzeReverseStream( | 1002 result = apm_->AnalyzeReverseStream( |
| 1011 &frame_data_.input_frame[0], frame_data_.input_samples_per_channel, | 1003 &frame_data_.input_frame[0], frame_data_.input_samples_per_channel, |
| 1012 frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout); | 1004 frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout); |
| 1013 break; | 1005 break; |
| 1014 default: | 1006 default: |
| 1015 FAIL(); | 1007 FAIL(); |
| 1016 } | 1008 } |
| 1017 | 1009 |
| 1018 // Check the return code for error. | 1010 // Check the return code for error. |
| 1019 ASSERT_EQ(AudioProcessing::kNoError, result); | 1011 ASSERT_EQ(AudioProcessing::kNoError, result); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 DISABLED_AudioProcessingImplLockExtensive, | 1126 DISABLED_AudioProcessingImplLockExtensive, |
| 1135 AudioProcessingImplLockTest, | 1127 AudioProcessingImplLockTest, |
| 1136 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); | 1128 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); |
| 1137 | 1129 |
| 1138 INSTANTIATE_TEST_CASE_P( | 1130 INSTANTIATE_TEST_CASE_P( |
| 1139 AudioProcessingImplLockBrief, | 1131 AudioProcessingImplLockBrief, |
| 1140 AudioProcessingImplLockTest, | 1132 AudioProcessingImplLockTest, |
| 1141 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); | 1133 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); |
| 1142 | 1134 |
| 1143 } // namespace webrtc | 1135 } // namespace webrtc |
| OLD | NEW |