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

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

Issue 1766383002: Convert IntelligibilityEnhancer to multi-threaded mode (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Formatting Created 4 years, 9 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 return ProcessReverseStreamLocked(); 914 return ProcessReverseStreamLocked();
915 } 915 }
916 916
917 int AudioProcessingImpl::ProcessReverseStreamLocked() { 917 int AudioProcessingImpl::ProcessReverseStreamLocked() {
918 AudioBuffer* ra = render_.render_audio.get(); // For brevity. 918 AudioBuffer* ra = render_.render_audio.get(); // For brevity.
919 if (formats_.rev_proc_format.sample_rate_hz() == kSampleRate32kHz) { 919 if (formats_.rev_proc_format.sample_rate_hz() == kSampleRate32kHz) {
920 ra->SplitIntoFrequencyBands(); 920 ra->SplitIntoFrequencyBands();
921 } 921 }
922 922
923 if (constants_.intelligibility_enabled) { 923 if (constants_.intelligibility_enabled) {
924 // Currently run in single-threaded mode when the intelligibility
925 // enhancer is activated.
926 // TODO(peah): Fix to be properly multi-threaded.
927 rtc::CritScope cs(&crit_capture_);
928 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( 924 public_submodules_->intelligibility_enhancer->ProcessRenderAudio(
929 ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate, 925 ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate,
930 ra->num_channels()); 926 ra->num_channels());
931 } 927 }
932 928
933 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra)); 929 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra));
934 RETURN_ON_ERR( 930 RETURN_ON_ERR(
935 public_submodules_->echo_control_mobile->ProcessRenderAudio(ra)); 931 public_submodules_->echo_control_mobile->ProcessRenderAudio(ra));
936 if (!constants_.use_experimental_agc) { 932 if (!constants_.use_experimental_agc) {
937 RETURN_ON_ERR(public_submodules_->gain_control->ProcessRenderAudio(ra)); 933 RETURN_ON_ERR(public_submodules_->gain_control->ProcessRenderAudio(ra));
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 } 1225 }
1230 private_submodules_->beamformer->Initialize(kChunkSizeMs, 1226 private_submodules_->beamformer->Initialize(kChunkSizeMs,
1231 capture_nonlocked_.split_rate); 1227 capture_nonlocked_.split_rate);
1232 } 1228 }
1233 } 1229 }
1234 1230
1235 void AudioProcessingImpl::InitializeIntelligibility() { 1231 void AudioProcessingImpl::InitializeIntelligibility() {
1236 if (constants_.intelligibility_enabled) { 1232 if (constants_.intelligibility_enabled) {
1237 public_submodules_->intelligibility_enhancer.reset( 1233 public_submodules_->intelligibility_enhancer.reset(
1238 new IntelligibilityEnhancer(capture_nonlocked_.split_rate, 1234 new IntelligibilityEnhancer(capture_nonlocked_.split_rate,
1239 render_.render_audio->num_channels())); 1235 render_.render_audio->num_channels(),
1236 NoiseSuppressionImpl::num_noise_bins()));
1240 } 1237 }
1241 } 1238 }
1242 1239
1243 void AudioProcessingImpl::InitializeHighPassFilter() { 1240 void AudioProcessingImpl::InitializeHighPassFilter() {
1244 public_submodules_->high_pass_filter->Initialize(num_proc_channels(), 1241 public_submodules_->high_pass_filter->Initialize(num_proc_channels(),
1245 proc_sample_rate_hz()); 1242 proc_sample_rate_hz());
1246 } 1243 }
1247 1244
1248 void AudioProcessingImpl::InitializeNoiseSuppression() { 1245 void AudioProcessingImpl::InitializeNoiseSuppression() {
1249 public_submodules_->noise_suppression->Initialize(num_proc_channels(), 1246 public_submodules_->noise_suppression->Initialize(num_proc_channels(),
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); 1453 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config);
1457 1454
1458 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 1455 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
1459 &debug_dump_.num_bytes_left_for_log_, 1456 &debug_dump_.num_bytes_left_for_log_,
1460 &crit_debug_, &debug_dump_.capture)); 1457 &crit_debug_, &debug_dump_.capture));
1461 return kNoError; 1458 return kNoError;
1462 } 1459 }
1463 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1460 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1464 1461
1465 } // namespace webrtc 1462 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698