#include "modules/audio_processing/agc2/saturation_protector.h"
#include <memory>
#include "modules/audio_processing/agc2/agc2_common.h"
#include "modules/audio_processing/agc2/saturation_protector_buffer.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_minmax.h"
namespace webrtc {
namespace {
constexpr int kPeakEnveloperSuperFrameLengthMs = …;
constexpr float kMinMarginDb = …;
constexpr float kMaxMarginDb = …;
constexpr float kAttack = …;
constexpr float kDecay = …;
struct SaturationProtectorState { … };
void ResetSaturationProtectorState(float initial_headroom_db,
SaturationProtectorState& state) { … }
void UpdateSaturationProtectorState(float peak_dbfs,
float speech_level_dbfs,
SaturationProtectorState& state) { … }
class SaturationProtectorImpl : public SaturationProtector { … };
}
std::unique_ptr<SaturationProtector> CreateSaturationProtector(
float initial_headroom_db,
int adjacent_speech_frames_threshold,
ApmDataDumper* apm_data_dumper) { … }
}