Revert of Introduced new scheme for controlling the functionality inside the audio processing module (patchset #12 id:260001 of https://codereview.webrtc.org/2292863002/ )
Reason for revert:
Interface change in the mock breaks downstream code.
Original issue's description:
> The current scheme for setting parameters and specifying the behavior
> of the audio processing module is quite complex and hard to implement
> in a threadsafe and efficient manner. Therefore a new scheme for setting
> the parameters in the audio processing module is introduced in this CL.
>
> The idea is to roll this scheme out gradually and as a first functionality
> in the audio processing module where this is applied the level controller
> was chosen. This CL includes the replacement of the Config-based
> level controller scheme with the new scheme.
>
> BUG=webrtc:5298
>
> Committed: https://crrev.com/c8bbe3fe9aad9e9a1189a42dcaa8f5d6c261ecc8
> Cr-Commit-Position: refs/heads/master@{#14171}
TBR=solenberg@webrtc.org,henrik.lundin@webrtc.org,peah@webrtc.org
BUG=webrtc:5298
NOTRY=True
Review-Url: https://codereview.webrtc.org/2334583002
Cr-Commit-Position: refs/heads/master@{#14177}
diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h
index 035fa32..44ff732 100644
--- a/webrtc/modules/audio_processing/include/audio_processing.h
+++ b/webrtc/modules/audio_processing/include/audio_processing.h
@@ -91,6 +91,14 @@
bool enabled;
};
+// Enables the adaptive level controller.
+struct LevelControl {
+ LevelControl() : enabled(false) {}
+ explicit LevelControl(bool enabled) : enabled(enabled) {}
+ static const ConfigOptionID identifier = ConfigOptionID::kLevelControl;
+ bool enabled;
+};
+
// Enables delay-agnostic echo cancellation. This feature relies on internally
// estimated delays between the process and reverse streams, thus not relying
// on reported system delays. This configuration only applies to
@@ -197,10 +205,6 @@
// Usage example, omitting error checking:
// AudioProcessing* apm = AudioProcessing::Create(0);
//
-// AudioProcessing::Config config;
-// config.level_controller.enabled = true;
-// apm->ApplyConfig(config)
-//
// apm->high_pass_filter()->Enable(true);
//
// apm->echo_cancellation()->enable_drift_compensation(false);
@@ -240,29 +244,14 @@
//
class AudioProcessing {
public:
- // The struct below constitutes the new parameter scheme for the audio
- // processing. It is being introduced gradually and until it is fully
- // introduced, it is prone to change.
- // TODO(peah): Remove this comment once the new config scheme is fully rolled
- // out.
- //
- // The parameters and behavior of the audio processing module are controlled
- // by changing the default values in the AudioProcessing::Config struct.
- // The config is applied by passing the struct to the ApplyConfig method.
- struct Config {
- struct LevelController {
- bool enabled = false;
- } level_controller;
- };
-
// TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone.
enum ChannelLayout {
kMono,
// Left, right.
kStereo,
- // Mono, keyboard, and mic.
+ // Mono, keyboard mic.
kMonoAndKeyboard,
- // Left, right, keyboard, and mic.
+ // Left, right, keyboard mic.
kStereoAndKeyboard
};
@@ -273,9 +262,9 @@
// be one instance for every incoming stream.
static AudioProcessing* Create();
// Allows passing in an optional configuration at create-time.
- static AudioProcessing* Create(const webrtc::Config& config);
+ static AudioProcessing* Create(const Config& config);
// Only for testing.
- static AudioProcessing* Create(const webrtc::Config& config,
+ static AudioProcessing* Create(const Config& config,
NonlinearBeamformer* beamformer);
virtual ~AudioProcessing() {}
@@ -311,13 +300,9 @@
ChannelLayout output_layout,
ChannelLayout reverse_layout) = 0;
- // TODO(peah): This method is a temporary solution used to take control
- // over the parameters in the audio processing module and is likely to change.
- virtual void ApplyConfig(const Config& config) = 0;
-
// Pass down additional options which don't have explicit setters. This
// ensures the options are applied immediately.
- virtual void SetExtraOptions(const webrtc::Config& config) = 0;
+ virtual void SetExtraOptions(const Config& config) = 0;
// TODO(ajm): Only intended for internal use. Make private and friend the
// necessary classes?