blob: 2ff20099e2c4682e5c20fa88a86d69d5a2f270c4 [file] [log] [blame]
Ivo Creusen56d46092017-11-24 17:29:59 +01001/*
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
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stdint.h>
15
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020016#include "absl/types/optional.h"
Mirko Bonadei3d255302018-10-11 10:50:45 +020017#include "rtc_base/system/rtc_export.h"
Ivo Creusen56d46092017-11-24 17:29:59 +010018
19namespace webrtc {
20// This version of the stats uses Optionals, it will replace the regular
21// AudioProcessingStatistics struct.
Mirko Bonadei3d255302018-10-11 10:50:45 +020022struct RTC_EXPORT AudioProcessingStats {
Ivo Creusen56d46092017-11-24 17:29:59 +010023 AudioProcessingStats();
24 AudioProcessingStats(const AudioProcessingStats& other);
25 ~AudioProcessingStats();
26
27 // AEC Statistics.
28 // ERL = 10log_10(P_far / P_echo)
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020029 absl::optional<double> echo_return_loss;
Ivo Creusen56d46092017-11-24 17:29:59 +010030 // ERLE = 10log_10(P_echo / P_out)
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020031 absl::optional<double> echo_return_loss_enhancement;
Ivo Creusen56d46092017-11-24 17:29:59 +010032 // Fraction of time that the AEC linear filter is divergent, in a 1-second
33 // non-overlapped aggregation window.
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020034 absl::optional<double> divergent_filter_fraction;
Ivo Creusen56d46092017-11-24 17:29:59 +010035
36 // The delay metrics consists of the delay median and standard deviation. It
37 // also consists of the fraction of delay estimates that can make the echo
38 // cancellation perform poorly. The values are aggregated until the first
39 // call to |GetStatistics()| and afterwards aggregated and updated every
40 // second. Note that if there are several clients pulling metrics from
41 // |GetStatistics()| during a session the first call from any of them will
42 // change to one second aggregation window for all.
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020043 absl::optional<int32_t> delay_median_ms;
44 absl::optional<int32_t> delay_standard_deviation_ms;
Ivo Creusen56d46092017-11-24 17:29:59 +010045
46 // Residual echo detector likelihood.
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020047 absl::optional<double> residual_echo_likelihood;
Ivo Creusen56d46092017-11-24 17:29:59 +010048 // Maximum residual echo likelihood from the last time period.
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020049 absl::optional<double> residual_echo_likelihood_recent_max;
Per Ã…hgren83c4a022017-11-27 12:07:09 +010050
51 // The instantaneous delay estimate produced in the AEC. The unit is in
52 // milliseconds and the value is the instantaneous value at the time of the
53 // call to |GetStatistics()|.
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020054 absl::optional<int32_t> delay_ms;
Ivo Creusen56d46092017-11-24 17:29:59 +010055};
56
57} // namespace webrtc
58
59#endif // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_