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_RENDER_DELAY_CONTROLLER_METRICS_H_ 12 #define MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_ 13 14 #include <stddef.h> 15 16 #include "absl/types/optional.h" 17 #include "modules/audio_processing/aec3/clockdrift_detector.h" 18 19 namespace webrtc { 20 21 // Handles the reporting of metrics for the render delay controller. 22 class RenderDelayControllerMetrics { 23 public: 24 RenderDelayControllerMetrics(); 25 26 RenderDelayControllerMetrics(const RenderDelayControllerMetrics&) = delete; 27 RenderDelayControllerMetrics& operator=(const RenderDelayControllerMetrics&) = 28 delete; 29 30 // Updates the metric with new data. 31 void Update(absl::optional<size_t> delay_samples, 32 absl::optional<size_t> buffer_delay_blocks, 33 ClockdriftDetector::Level clockdrift); 34 35 private: 36 // Resets the metrics. 37 void ResetMetrics(); 38 39 size_t delay_blocks_ = 0; 40 int reliable_delay_estimate_counter_ = 0; 41 int delay_change_counter_ = 0; 42 int call_counter_ = 0; 43 int initial_call_counter_ = 0; 44 bool initial_update = true; 45 }; 46 47 } // namespace webrtc 48 49 #endif // MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_ 50