Add replacement interface for webrtc::GainConrol
The pointer-to-submodule interfaces are being removed. This CL: 1) introduces AudioProcessing::Config::GainController1 with most config, 2) adds functions to APM for setting and getting analog gain, 3) creates a temporary GainControlConfigProxy to support the transition to the new config. 4) Moves the lock references in GainControlForExperimentalAgc and GainControlImpl into the GainControlConfigProxy, as it becomes the sole AGC object with functionality exposed to the client. Bug: webrtc:9947, webrtc:9878 Change-Id: Ic31e15e9bb26d6497a92b77874e0b6cab21ff2b2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126485 Commit-Queue: Sam Zackrisson <saza@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27316}
This commit is contained in:
committed by
Commit Bot
parent
4bd3177ae5
commit
f0d1c03c31
@ -20,8 +20,6 @@
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/include/gain_control.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
#include "rtc_base/critical_section.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -30,7 +28,10 @@ class AudioBuffer;
|
||||
|
||||
class GainControlImpl : public GainControl {
|
||||
public:
|
||||
explicit GainControlImpl(rtc::CriticalSection* crit_capture);
|
||||
GainControlImpl();
|
||||
GainControlImpl(const GainControlImpl&) = delete;
|
||||
GainControlImpl& operator=(const GainControlImpl&) = delete;
|
||||
|
||||
~GainControlImpl() override;
|
||||
|
||||
void ProcessRenderAudio(rtc::ArrayView<const int16_t> packed_render_audio);
|
||||
@ -44,7 +45,7 @@ class GainControlImpl : public GainControl {
|
||||
|
||||
// GainControl implementation.
|
||||
bool is_enabled() const override;
|
||||
int stream_analog_level() override;
|
||||
int stream_analog_level() const override;
|
||||
bool is_limiter_enabled() const override;
|
||||
Mode mode() const override;
|
||||
|
||||
@ -66,31 +67,28 @@ class GainControlImpl : public GainControl {
|
||||
int analog_level_maximum() const override;
|
||||
bool stream_is_saturated() const override;
|
||||
|
||||
int Configure() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
|
||||
|
||||
rtc::CriticalSection* const crit_capture_;
|
||||
int Configure();
|
||||
|
||||
std::unique_ptr<ApmDataDumper> data_dumper_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
Mode mode_ RTC_GUARDED_BY(crit_capture_);
|
||||
int minimum_capture_level_ RTC_GUARDED_BY(crit_capture_);
|
||||
int maximum_capture_level_ RTC_GUARDED_BY(crit_capture_);
|
||||
bool limiter_enabled_ RTC_GUARDED_BY(crit_capture_);
|
||||
int target_level_dbfs_ RTC_GUARDED_BY(crit_capture_);
|
||||
int compression_gain_db_ RTC_GUARDED_BY(crit_capture_);
|
||||
int analog_capture_level_ RTC_GUARDED_BY(crit_capture_);
|
||||
bool was_analog_level_set_ RTC_GUARDED_BY(crit_capture_);
|
||||
bool stream_is_saturated_ RTC_GUARDED_BY(crit_capture_);
|
||||
Mode mode_;
|
||||
int minimum_capture_level_;
|
||||
int maximum_capture_level_;
|
||||
bool limiter_enabled_;
|
||||
int target_level_dbfs_;
|
||||
int compression_gain_db_;
|
||||
int analog_capture_level_;
|
||||
bool was_analog_level_set_;
|
||||
bool stream_is_saturated_;
|
||||
|
||||
std::vector<std::unique_ptr<GainController>> gain_controllers_;
|
||||
|
||||
absl::optional<size_t> num_proc_channels_ RTC_GUARDED_BY(crit_capture_);
|
||||
absl::optional<int> sample_rate_hz_ RTC_GUARDED_BY(crit_capture_);
|
||||
absl::optional<size_t> num_proc_channels_;
|
||||
absl::optional<int> sample_rate_hz_;
|
||||
|
||||
static int instance_counter_;
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GainControlImpl);
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user