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