| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 22 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
| 23 extern "C" { | 23 extern "C" { |
| 24 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 24 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
| 25 } | 25 } |
| 26 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" | 26 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" |
| 27 #include "webrtc/modules/audio_processing/audio_buffer.h" | 27 #include "webrtc/modules/audio_processing/audio_buffer.h" |
| 28 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" | 28 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" |
| 29 #include "webrtc/modules/audio_processing/common.h" | 29 #include "webrtc/modules/audio_processing/common.h" |
| 30 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" | 30 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" |
| 31 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" | 31 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" |
| 32 #include "webrtc/modules/audio_processing/gain_control_for_new_agc.h" |
| 32 #include "webrtc/modules/audio_processing/gain_control_impl.h" | 33 #include "webrtc/modules/audio_processing/gain_control_impl.h" |
| 33 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" | 34 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" |
| 34 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" | 35 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" |
| 35 #include "webrtc/modules/audio_processing/level_estimator_impl.h" | 36 #include "webrtc/modules/audio_processing/level_estimator_impl.h" |
| 36 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" | 37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" |
| 37 #include "webrtc/modules/audio_processing/processing_component.h" | 38 #include "webrtc/modules/audio_processing/processing_component.h" |
| 38 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" | 39 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" |
| 39 #include "webrtc/modules/audio_processing/voice_detection_impl.h" | 40 #include "webrtc/modules/audio_processing/voice_detection_impl.h" |
| 40 #include "webrtc/modules/include/module_common_types.h" | 41 #include "webrtc/modules/include/module_common_types.h" |
| 41 #include "webrtc/system_wrappers/include/file_wrapper.h" | 42 #include "webrtc/system_wrappers/include/file_wrapper.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 74 } |
| 74 | 75 |
| 75 assert(false); | 76 assert(false); |
| 76 return false; | 77 return false; |
| 77 } | 78 } |
| 78 } // namespace | 79 } // namespace |
| 79 | 80 |
| 80 // Throughout webrtc, it's assumed that success is represented by zero. | 81 // Throughout webrtc, it's assumed that success is represented by zero. |
| 81 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); | 82 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); |
| 82 | 83 |
| 83 // This class has two main functionalities: | |
| 84 // | |
| 85 // 1) It is returned instead of the real GainControl after the new AGC has been | |
| 86 // enabled in order to prevent an outside user from overriding compression | |
| 87 // settings. It doesn't do anything in its implementation, except for | |
| 88 // delegating the const methods and Enable calls to the real GainControl, so | |
| 89 // AGC can still be disabled. | |
| 90 // | |
| 91 // 2) It is injected into AgcManagerDirect and implements volume callbacks for | |
| 92 // getting and setting the volume level. It just caches this value to be used | |
| 93 // in VoiceEngine later. | |
| 94 class GainControlForNewAgc : public GainControl, public VolumeCallbacks { | |
| 95 public: | |
| 96 explicit GainControlForNewAgc(GainControlImpl* gain_control) | |
| 97 : real_gain_control_(gain_control), volume_(0) {} | |
| 98 | |
| 99 // GainControl implementation. | |
| 100 int Enable(bool enable) override { | |
| 101 return real_gain_control_->Enable(enable); | |
| 102 } | |
| 103 bool is_enabled() const override { return real_gain_control_->is_enabled(); } | |
| 104 int set_stream_analog_level(int level) override { | |
| 105 volume_ = level; | |
| 106 return AudioProcessing::kNoError; | |
| 107 } | |
| 108 int stream_analog_level() override { return volume_; } | |
| 109 int set_mode(Mode mode) override { return AudioProcessing::kNoError; } | |
| 110 Mode mode() const override { return GainControl::kAdaptiveAnalog; } | |
| 111 int set_target_level_dbfs(int level) override { | |
| 112 return AudioProcessing::kNoError; | |
| 113 } | |
| 114 int target_level_dbfs() const override { | |
| 115 return real_gain_control_->target_level_dbfs(); | |
| 116 } | |
| 117 int set_compression_gain_db(int gain) override { | |
| 118 return AudioProcessing::kNoError; | |
| 119 } | |
| 120 int compression_gain_db() const override { | |
| 121 return real_gain_control_->compression_gain_db(); | |
| 122 } | |
| 123 int enable_limiter(bool enable) override { return AudioProcessing::kNoError; } | |
| 124 bool is_limiter_enabled() const override { | |
| 125 return real_gain_control_->is_limiter_enabled(); | |
| 126 } | |
| 127 int set_analog_level_limits(int minimum, int maximum) override { | |
| 128 return AudioProcessing::kNoError; | |
| 129 } | |
| 130 int analog_level_minimum() const override { | |
| 131 return real_gain_control_->analog_level_minimum(); | |
| 132 } | |
| 133 int analog_level_maximum() const override { | |
| 134 return real_gain_control_->analog_level_maximum(); | |
| 135 } | |
| 136 bool stream_is_saturated() const override { | |
| 137 return real_gain_control_->stream_is_saturated(); | |
| 138 } | |
| 139 | |
| 140 // VolumeCallbacks implementation. | |
| 141 void SetMicVolume(int volume) override { volume_ = volume; } | |
| 142 int GetMicVolume() override { return volume_; } | |
| 143 | |
| 144 private: | |
| 145 GainControl* real_gain_control_; | |
| 146 int volume_; | |
| 147 }; | |
| 148 | |
| 149 struct AudioProcessingImpl::ApmPublicSubmodules { | 84 struct AudioProcessingImpl::ApmPublicSubmodules { |
| 150 ApmPublicSubmodules() | 85 ApmPublicSubmodules() |
| 151 : echo_cancellation(nullptr), | 86 : echo_cancellation(nullptr), |
| 152 echo_control_mobile(nullptr), | 87 echo_control_mobile(nullptr), |
| 153 gain_control(nullptr) {} | 88 gain_control(nullptr) {} |
| 154 // Accessed externally of APM without any lock acquired. | 89 // Accessed externally of APM without any lock acquired. |
| 155 EchoCancellationImpl* echo_cancellation; | 90 EchoCancellationImpl* echo_cancellation; |
| 156 EchoControlMobileImpl* echo_control_mobile; | 91 EchoControlMobileImpl* echo_control_mobile; |
| 157 GainControlImpl* gain_control; | 92 GainControlImpl* gain_control; |
| 158 rtc::scoped_ptr<HighPassFilterImpl> high_pass_filter; | 93 rtc::scoped_ptr<HighPassFilterImpl> high_pass_filter; |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); | 1478 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); |
| 1544 | 1479 |
| 1545 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 1480 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
| 1546 &debug_dump_.num_bytes_left_for_log_, | 1481 &debug_dump_.num_bytes_left_for_log_, |
| 1547 &crit_debug_, &debug_dump_.capture)); | 1482 &crit_debug_, &debug_dump_.capture)); |
| 1548 return kNoError; | 1483 return kNoError; |
| 1549 } | 1484 } |
| 1550 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1485 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
| 1551 | 1486 |
| 1552 } // namespace webrtc | 1487 } // namespace webrtc |
| OLD | NEW |