• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "rtc_base/constructor_magic.h"
19 
20 namespace webrtc {
21 
22 // Handles the reporting of metrics for the render delay controller.
23 class RenderDelayControllerMetrics {
24  public:
25   RenderDelayControllerMetrics();
26 
27   // Updates the metric with new data.
28   void Update(absl::optional<size_t> delay_samples,
29               size_t buffer_delay_blocks,
30               absl::optional<int> skew_shift_blocks,
31               ClockdriftDetector::Level clockdrift);
32 
33   // Returns true if the metrics have just been reported, otherwise false.
MetricsReported()34   bool MetricsReported() { return metrics_reported_; }
35 
36  private:
37   // Resets the metrics.
38   void ResetMetrics();
39 
40   size_t delay_blocks_ = 0;
41   int reliable_delay_estimate_counter_ = 0;
42   int delay_change_counter_ = 0;
43   int call_counter_ = 0;
44   int skew_report_timer_ = 0;
45   int initial_call_counter_ = 0;
46   bool metrics_reported_ = false;
47   bool initial_update = true;
48   int skew_shift_count_ = 0;
49 
50   RTC_DISALLOW_COPY_AND_ASSIGN(RenderDelayControllerMetrics);
51 };
52 
53 }  // namespace webrtc
54 
55 #endif  // MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_
56