chromium/third_party/webrtc/modules/audio_processing/agc2/saturation_protector_unittest.cc

/*
 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "modules/audio_processing/agc2/saturation_protector.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 {

constexpr float kInitialHeadroomDb =;
constexpr int kNoAdjacentSpeechFramesRequired =;
constexpr float kMaxSpeechProbability =;

// Calls `Analyze(speech_probability, peak_dbfs, speech_level_dbfs)`
// `num_iterations` times on `saturation_protector` and return the largest
// headroom difference between two consecutive calls.
float RunOnConstantLevel(int num_iterations,
                         float speech_probability,
                         float peak_dbfs,
                         float speech_level_dbfs,
                         SaturationProtector& saturation_protector) {}

// Checks that the returned headroom value is correctly reset.
TEST(GainController2SaturationProtector, Reset) {}

// Checks that the estimate converges to the ratio between peaks and level
// estimator values after a while.
TEST(GainController2SaturationProtector, EstimatesCrestRatio) {}

// Checks that the headroom does not change too quickly.
TEST(GainController2SaturationProtector, ChangeSlowly) {}

class SaturationProtectorParametrization
    : public ::testing::TestWithParam<int> {};

TEST_P(SaturationProtectorParametrization, DoNotAdaptToShortSpeechSegments) {}

TEST_P(SaturationProtectorParametrization, AdaptToEnoughSpeechSegments) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace webrtc