Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 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 | |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 14 | #include <stdint.h> |
| 15 | |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 16 | #include "absl/types/optional.h" |
Mirko Bonadei | 3d25530 | 2018-10-11 10:50:45 +0200 | [diff] [blame] | 17 | #include "rtc_base/system/rtc_export.h" |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | // This version of the stats uses Optionals, it will replace the regular |
| 21 | // AudioProcessingStatistics struct. |
Mirko Bonadei | 3d25530 | 2018-10-11 10:50:45 +0200 | [diff] [blame] | 22 | struct RTC_EXPORT AudioProcessingStats { |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 23 | AudioProcessingStats(); |
| 24 | AudioProcessingStats(const AudioProcessingStats& other); |
| 25 | ~AudioProcessingStats(); |
| 26 | |
Sam Zackrisson | b24c00f | 2018-11-26 16:18:25 +0100 | [diff] [blame] | 27 | // The root mean square (RMS) level in dBFS (decibels from digital |
| 28 | // full-scale) of the last capture frame, after processing. It is |
| 29 | // constrained to [-127, 0]. |
| 30 | // The computation follows: https://tools.ietf.org/html/rfc6465 |
| 31 | // with the intent that it can provide the RTP audio level indication. |
| 32 | // Only reported if level estimation is enabled in AudioProcessing::Config. |
| 33 | absl::optional<int> output_rms_dbfs; |
| 34 | |
Sam Zackrisson | 4db667b | 2018-12-21 16:29:27 +0100 | [diff] [blame^] | 35 | // True if voice is detected in the last capture frame, after processing. |
| 36 | // It is conservative in flagging audio as speech, with low likelihood of |
| 37 | // incorrectly flagging a frame as voice. |
| 38 | // Only reported if voice detection is enabled in AudioProcessing::Config. |
| 39 | absl::optional<bool> voice_detected; |
| 40 | |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 41 | // AEC Statistics. |
| 42 | // ERL = 10log_10(P_far / P_echo) |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 43 | absl::optional<double> echo_return_loss; |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 44 | // ERLE = 10log_10(P_echo / P_out) |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 45 | absl::optional<double> echo_return_loss_enhancement; |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 46 | // Fraction of time that the AEC linear filter is divergent, in a 1-second |
| 47 | // non-overlapped aggregation window. |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 48 | absl::optional<double> divergent_filter_fraction; |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 49 | |
| 50 | // The delay metrics consists of the delay median and standard deviation. It |
| 51 | // also consists of the fraction of delay estimates that can make the echo |
| 52 | // cancellation perform poorly. The values are aggregated until the first |
| 53 | // call to |GetStatistics()| and afterwards aggregated and updated every |
| 54 | // second. Note that if there are several clients pulling metrics from |
| 55 | // |GetStatistics()| during a session the first call from any of them will |
| 56 | // change to one second aggregation window for all. |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 57 | absl::optional<int32_t> delay_median_ms; |
| 58 | absl::optional<int32_t> delay_standard_deviation_ms; |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 59 | |
| 60 | // Residual echo detector likelihood. |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 61 | absl::optional<double> residual_echo_likelihood; |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 62 | // Maximum residual echo likelihood from the last time period. |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 63 | absl::optional<double> residual_echo_likelihood_recent_max; |
Per Ã…hgren | 83c4a02 | 2017-11-27 12:07:09 +0100 | [diff] [blame] | 64 | |
| 65 | // The instantaneous delay estimate produced in the AEC. The unit is in |
| 66 | // milliseconds and the value is the instantaneous value at the time of the |
| 67 | // call to |GetStatistics()|. |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 68 | absl::optional<int32_t> delay_ms; |
Ivo Creusen | 56d4609 | 2017-11-24 17:29:59 +0100 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | } // namespace webrtc |
| 72 | |
| 73 | #endif // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_ |