1 /*
2  *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_AUDIO_PROCESSING_AEC3_SHADOW_FILTER_UPDATE_GAIN_H_
12 #define MODULES_AUDIO_PROCESSING_AEC3_SHADOW_FILTER_UPDATE_GAIN_H_
13 
14 #include "modules/audio_processing/aec3/aec3_common.h"
15 #include "modules/audio_processing/aec3/render_buffer.h"
16 #include "modules/audio_processing/aec3/render_signal_analyzer.h"
17 #include "rtc_base/constructormagic.h"
18 
19 namespace webrtc {
20 
21 // Provides functionality for computing the fixed gain for the shadow filter.
22 class ShadowFilterUpdateGain {
23  public:
24   // Takes action in the case of a known echo path change.
25   void HandleEchoPathChange();
26 
27   // Computes the gain.
28   void Compute(const RenderBuffer& render_buffer,
29                const RenderSignalAnalyzer& render_signal_analyzer,
30                const FftData& E_shadow,
31                size_t size_partitions,
32                bool saturated_capture_signal,
33                FftData* G);
34 
35  private:
36   // TODO(peah): Check whether this counter should instead be initialized to a
37   // large value.
38   size_t poor_signal_excitation_counter_ = 0;
39   size_t call_counter_ = 0;
40 };
41 
42 }  // namespace webrtc
43 
44 #endif  // MODULES_AUDIO_PROCESSING_AEC3_SHADOW_FILTER_UPDATE_GAIN_H_
45