#include "modules/audio_processing/gain_controller2.h"
#include <memory>
#include <utility>
#include "api/audio/audio_frame.h"
#include "common_audio/include/audio_util.h"
#include "modules/audio_processing/agc2/agc2_common.h"
#include "modules/audio_processing/agc2/cpu_features.h"
#include "modules/audio_processing/audio_buffer.h"
#include "modules/audio_processing/include/audio_frame_view.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
Agc2Config;
InputVolumeControllerConfig;
constexpr int kLogLimiterStatsPeriodMs = …;
constexpr int kFrameLengthMs = …;
constexpr int kLogLimiterStatsPeriodNumFrames = …;
AvailableCpuFeatures GetAllowedCpuFeatures() { … }
struct AudioLevels { … };
struct SpeechLevel { … };
AudioLevels ComputeAudioLevels(DeinterleavedView<float> frame,
ApmDataDumper& data_dumper) { … }
}
std::atomic<int> GainController2::instance_count_(0);
GainController2::GainController2(
const Agc2Config& config,
const InputVolumeControllerConfig& input_volume_controller_config,
int sample_rate_hz,
int num_channels,
bool use_internal_vad)
: … { … }
GainController2::~GainController2() = default;
void GainController2::SetCaptureOutputUsed(bool capture_output_used) { … }
void GainController2::SetFixedGainDb(float gain_db) { … }
void GainController2::Analyze(int applied_input_volume,
const AudioBuffer& audio_buffer) { … }
void GainController2::Process(absl::optional<float> speech_probability,
bool input_volume_changed,
AudioBuffer* audio) { … }
bool GainController2::Validate(
const AudioProcessing::Config::GainController2& config) { … }
}