OLD | NEW |
---|---|
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 |
11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" | 11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <algorithm> | 14 #include <algorithm> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/platform_file.h" | 17 #include "webrtc/base/platform_file.h" |
18 #include "webrtc/common_audio/audio_converter.h" | 18 #include "webrtc/common_audio/audio_converter.h" |
minyue-webrtc
2015/08/28 14:27:00
changes in this file are mainly due to rebase. Ple
| |
19 #include "webrtc/common_audio/channel_buffer.h" | 19 #include "webrtc/common_audio/channel_buffer.h" |
20 #include "webrtc/common_audio/include/audio_util.h" | 20 #include "webrtc/common_audio/include/audio_util.h" |
21 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" | 21 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" |
22 extern "C" { | 22 extern "C" { |
23 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 23 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
24 } | 24 } |
25 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" | 25 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" |
26 #include "webrtc/modules/audio_processing/audio_buffer.h" | 26 #include "webrtc/modules/audio_processing/audio_buffer.h" |
27 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" | 27 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" |
28 #include "webrtc/modules/audio_processing/common.h" | 28 #include "webrtc/modules/audio_processing/common.h" |
29 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" | 29 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" |
30 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" | 30 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" |
31 #include "webrtc/modules/audio_processing/gain_control_impl.h" | 31 #include "webrtc/modules/audio_processing/gain_control_impl.h" |
32 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" | 32 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" |
33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc er.h" | 33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc er.h" |
34 #include "webrtc/modules/audio_processing/level_estimator_impl.h" | 34 #include "webrtc/modules/audio_processing/level_estimator_impl.h" |
35 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" | 35 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" |
36 #include "webrtc/modules/audio_processing/processing_component.h" | 36 #include "webrtc/modules/audio_processing/processing_component.h" |
37 #include "webrtc/modules/audio_processing/repetition_detector.h" | |
37 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" | 38 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" |
38 #include "webrtc/modules/audio_processing/voice_detection_impl.h" | 39 #include "webrtc/modules/audio_processing/voice_detection_impl.h" |
39 #include "webrtc/modules/interface/module_common_types.h" | 40 #include "webrtc/modules/interface/module_common_types.h" |
40 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 41 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
41 #include "webrtc/system_wrappers/interface/file_wrapper.h" | 42 #include "webrtc/system_wrappers/interface/file_wrapper.h" |
42 #include "webrtc/system_wrappers/interface/logging.h" | 43 #include "webrtc/system_wrappers/interface/logging.h" |
43 #include "webrtc/system_wrappers/interface/metrics.h" | 44 #include "webrtc/system_wrappers/interface/metrics.h" |
44 | 45 |
45 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 46 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
46 // Files generated at build-time by the protobuf compiler. | 47 // Files generated at build-time by the protobuf compiler. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 #endif | 208 #endif |
208 agc_startup_min_volume_(config.Get<ExperimentalAgc>().startup_min_volume), | 209 agc_startup_min_volume_(config.Get<ExperimentalAgc>().startup_min_volume), |
209 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 210 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
210 transient_suppressor_enabled_(false), | 211 transient_suppressor_enabled_(false), |
211 #else | 212 #else |
212 transient_suppressor_enabled_(config.Get<ExperimentalNs>().enabled), | 213 transient_suppressor_enabled_(config.Get<ExperimentalNs>().enabled), |
213 #endif | 214 #endif |
214 beamformer_enabled_(config.Get<Beamforming>().enabled), | 215 beamformer_enabled_(config.Get<Beamforming>().enabled), |
215 beamformer_(beamformer), | 216 beamformer_(beamformer), |
216 array_geometry_(config.Get<Beamforming>().array_geometry), | 217 array_geometry_(config.Get<Beamforming>().array_geometry), |
218 repetition_detector_(new RepetitionDetector()), | |
217 intelligibility_enabled_(config.Get<Intelligibility>().enabled) { | 219 intelligibility_enabled_(config.Get<Intelligibility>().enabled) { |
218 echo_cancellation_ = new EchoCancellationImpl(this, crit_); | 220 echo_cancellation_ = new EchoCancellationImpl(this, crit_); |
219 component_list_.push_back(echo_cancellation_); | 221 component_list_.push_back(echo_cancellation_); |
220 | 222 |
221 echo_control_mobile_ = new EchoControlMobileImpl(this, crit_); | 223 echo_control_mobile_ = new EchoControlMobileImpl(this, crit_); |
222 component_list_.push_back(echo_control_mobile_); | 224 component_list_.push_back(echo_control_mobile_); |
223 | 225 |
224 gain_control_ = new GainControlImpl(this, crit_); | 226 gain_control_ = new GainControlImpl(this, crit_); |
225 component_list_.push_back(gain_control_); | 227 component_list_.push_back(gain_control_); |
226 | 228 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 input_stream.set_has_keyboard(LayoutHasKeyboard(input_layout)); | 525 input_stream.set_has_keyboard(LayoutHasKeyboard(input_layout)); |
524 | 526 |
525 StreamConfig output_stream = api_format_.output_stream(); | 527 StreamConfig output_stream = api_format_.output_stream(); |
526 output_stream.set_sample_rate_hz(output_sample_rate_hz); | 528 output_stream.set_sample_rate_hz(output_sample_rate_hz); |
527 output_stream.set_num_channels(ChannelsFromLayout(output_layout)); | 529 output_stream.set_num_channels(ChannelsFromLayout(output_layout)); |
528 output_stream.set_has_keyboard(LayoutHasKeyboard(output_layout)); | 530 output_stream.set_has_keyboard(LayoutHasKeyboard(output_layout)); |
529 | 531 |
530 if (samples_per_channel != input_stream.num_frames()) { | 532 if (samples_per_channel != input_stream.num_frames()) { |
531 return kBadDataLengthError; | 533 return kBadDataLengthError; |
532 } | 534 } |
535 | |
536 repetition_detector_->Detect(src, sizeof(float) * input_stream.num_channels(), | |
537 samples_per_channel, input_sample_rate_hz); | |
538 | |
533 return ProcessStream(src, input_stream, output_stream, dest); | 539 return ProcessStream(src, input_stream, output_stream, dest); |
534 } | 540 } |
535 | 541 |
536 int AudioProcessingImpl::ProcessStream(const float* const* src, | 542 int AudioProcessingImpl::ProcessStream(const float* const* src, |
537 const StreamConfig& input_config, | 543 const StreamConfig& input_config, |
538 const StreamConfig& output_config, | 544 const StreamConfig& output_config, |
539 float* const* dest) { | 545 float* const* dest) { |
540 CriticalSectionScoped crit_scoped(crit_); | 546 CriticalSectionScoped crit_scoped(crit_); |
541 if (!src || !dest) { | 547 if (!src || !dest) { |
542 return kNullPointerError; | 548 return kNullPointerError; |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1242 int err = WriteMessageToDebugFile(); | 1248 int err = WriteMessageToDebugFile(); |
1243 if (err != kNoError) { | 1249 if (err != kNoError) { |
1244 return err; | 1250 return err; |
1245 } | 1251 } |
1246 | 1252 |
1247 return kNoError; | 1253 return kNoError; |
1248 } | 1254 } |
1249 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1255 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1250 | 1256 |
1251 } // namespace webrtc | 1257 } // namespace webrtc |
OLD | NEW |