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_ECHO_DETECTOR_MOVING_MAX_H_ 12 #define MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_MOVING_MAX_H_ 13 14 #include <stddef.h> 15 16 namespace webrtc { 17 18 class MovingMax { 19 public: 20 explicit MovingMax(size_t window_size); 21 ~MovingMax(); 22 23 void Update(float value); 24 float max() const; 25 // Reset all of the state in this class. 26 void Clear(); 27 28 private: 29 float max_value_ = 0.f; 30 size_t counter_ = 0; 31 size_t window_size_ = 1; 32 }; 33 34 } // namespace webrtc 35 36 #endif // MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_MOVING_MAX_H_ 37