Index: webrtc/modules/audio_processing/audio_processing_impl.cc |
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc |
index 0934b1e4afa9f519fa91e42dde7439f047e009b4..47b28b3f35121f512732548fc6913469a554a3e1 100644 |
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc |
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc |
@@ -29,6 +29,7 @@ extern "C" { |
#include "webrtc/modules/audio_processing/common.h" |
#include "webrtc/modules/audio_processing/echo_cancellation_impl.h" |
#include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" |
+#include "webrtc/modules/audio_processing/gain_control_for_new_agc.h" |
#include "webrtc/modules/audio_processing/gain_control_impl.h" |
#include "webrtc/modules/audio_processing/high_pass_filter_impl.h" |
#include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h" |
@@ -80,72 +81,6 @@ static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) { |
// Throughout webrtc, it's assumed that success is represented by zero. |
static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); |
-// This class has two main functionalities: |
-// |
-// 1) It is returned instead of the real GainControl after the new AGC has been |
-// enabled in order to prevent an outside user from overriding compression |
-// settings. It doesn't do anything in its implementation, except for |
-// delegating the const methods and Enable calls to the real GainControl, so |
-// AGC can still be disabled. |
-// |
-// 2) It is injected into AgcManagerDirect and implements volume callbacks for |
-// getting and setting the volume level. It just caches this value to be used |
-// in VoiceEngine later. |
-class GainControlForNewAgc : public GainControl, public VolumeCallbacks { |
- public: |
- explicit GainControlForNewAgc(GainControlImpl* gain_control) |
- : real_gain_control_(gain_control), volume_(0) {} |
- |
- // GainControl implementation. |
- int Enable(bool enable) override { |
- return real_gain_control_->Enable(enable); |
- } |
- bool is_enabled() const override { return real_gain_control_->is_enabled(); } |
- int set_stream_analog_level(int level) override { |
- volume_ = level; |
- return AudioProcessing::kNoError; |
- } |
- int stream_analog_level() override { return volume_; } |
- int set_mode(Mode mode) override { return AudioProcessing::kNoError; } |
- Mode mode() const override { return GainControl::kAdaptiveAnalog; } |
- int set_target_level_dbfs(int level) override { |
- return AudioProcessing::kNoError; |
- } |
- int target_level_dbfs() const override { |
- return real_gain_control_->target_level_dbfs(); |
- } |
- int set_compression_gain_db(int gain) override { |
- return AudioProcessing::kNoError; |
- } |
- int compression_gain_db() const override { |
- return real_gain_control_->compression_gain_db(); |
- } |
- int enable_limiter(bool enable) override { return AudioProcessing::kNoError; } |
- bool is_limiter_enabled() const override { |
- return real_gain_control_->is_limiter_enabled(); |
- } |
- int set_analog_level_limits(int minimum, int maximum) override { |
- return AudioProcessing::kNoError; |
- } |
- int analog_level_minimum() const override { |
- return real_gain_control_->analog_level_minimum(); |
- } |
- int analog_level_maximum() const override { |
- return real_gain_control_->analog_level_maximum(); |
- } |
- bool stream_is_saturated() const override { |
- return real_gain_control_->stream_is_saturated(); |
- } |
- |
- // VolumeCallbacks implementation. |
- void SetMicVolume(int volume) override { volume_ = volume; } |
- int GetMicVolume() override { return volume_; } |
- |
- private: |
- GainControl* real_gain_control_; |
- int volume_; |
-}; |
- |
struct AudioProcessingImpl::ApmPublicSubmodules { |
ApmPublicSubmodules() |
: echo_cancellation(nullptr), |