#include "modules/audio_processing/agc2/speech_level_estimator.h"
#include <memory>
#include "api/audio/audio_processing.h"
#include "modules/audio_processing/agc2/agc2_common.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/gunit.h"
namespace webrtc {
namespace {
AdaptiveDigitalConfig;
constexpr int kNumFramesToConfidence = …;
static_assert …;
constexpr float kConvergenceSpeedTestsLevelTolerance = …;
void RunOnConstantLevel(int num_iterations,
float rms_dbfs,
float peak_dbfs,
float speech_probability,
SpeechLevelEstimator& level_estimator) { … }
constexpr float kNoSpeechProbability = …;
constexpr float kLowSpeechProbability = …;
constexpr float kMaxSpeechProbability = …;
struct TestLevelEstimator { … };
TEST(GainController2SpeechLevelEstimator, LevelStabilizes) { … }
TEST(GainController2SpeechLevelEstimator, IsNotConfident) { … }
TEST(GainController2SpeechLevelEstimator, IsConfident) { … }
TEST(GainController2SpeechLevelEstimator, EstimatorIgnoresNonSpeechFrames) { … }
TEST(GainController2SpeechLevelEstimator, ConvergenceSpeedBeforeConfidence) { … }
TEST(GainController2SpeechLevelEstimator, ConvergenceSpeedAfterConfidence) { … }
class SpeechLevelEstimatorParametrization
: public ::testing::TestWithParam<int> { … };
TEST_P(SpeechLevelEstimatorParametrization, DoNotAdaptToShortSpeechSegments) { … }
TEST_P(SpeechLevelEstimatorParametrization, AdaptToEnoughSpeechSegments) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}