• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 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_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_
12 #define MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_
13 
14 #include <stdint.h>
15 
16 #include "absl/types/optional.h"
17 #include "rtc_base/system/rtc_export.h"
18 
19 namespace webrtc {
20 // This version of the stats uses Optionals, it will replace the regular
21 // AudioProcessingStatistics struct.
22 struct RTC_EXPORT AudioProcessingStats {
23   AudioProcessingStats();
24   AudioProcessingStats(const AudioProcessingStats& other);
25   ~AudioProcessingStats();
26 
27   // Deprecated.
28   // TODO(bugs.webrtc.org/11226): Remove.
29   // True if voice is detected in the last capture frame, after processing.
30   // It is conservative in flagging audio as speech, with low likelihood of
31   // incorrectly flagging a frame as voice.
32   // Only reported if voice detection is enabled in AudioProcessing::Config.
33   absl::optional<bool> voice_detected;
34 
35   // AEC Statistics.
36   // ERL = 10log_10(P_far / P_echo)
37   absl::optional<double> echo_return_loss;
38   // ERLE = 10log_10(P_echo / P_out)
39   absl::optional<double> echo_return_loss_enhancement;
40   // Fraction of time that the AEC linear filter is divergent, in a 1-second
41   // non-overlapped aggregation window.
42   absl::optional<double> divergent_filter_fraction;
43 
44   // The delay metrics consists of the delay median and standard deviation. It
45   // also consists of the fraction of delay estimates that can make the echo
46   // cancellation perform poorly. The values are aggregated until the first
47   // call to `GetStatistics()` and afterwards aggregated and updated every
48   // second. Note that if there are several clients pulling metrics from
49   // `GetStatistics()` during a session the first call from any of them will
50   // change to one second aggregation window for all.
51   absl::optional<int32_t> delay_median_ms;
52   absl::optional<int32_t> delay_standard_deviation_ms;
53 
54   // Residual echo detector likelihood.
55   absl::optional<double> residual_echo_likelihood;
56   // Maximum residual echo likelihood from the last time period.
57   absl::optional<double> residual_echo_likelihood_recent_max;
58 
59   // The instantaneous delay estimate produced in the AEC. The unit is in
60   // milliseconds and the value is the instantaneous value at the time of the
61   // call to `GetStatistics()`.
62   absl::optional<int32_t> delay_ms;
63 };
64 
65 }  // namespace webrtc
66 
67 #endif  // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_
68