From 78e88fe602d114a87e4c720c419338c1a7f62c2a Mon Sep 17 00:00:00 2001 From: Fredrik Solenberg Date: Mon, 19 Nov 2018 11:09:14 +0100 Subject: [PATCH] Move NetworkStatistics and AudioDecodingCallStats from common_types.h Bug: webrtc:7626 Change-Id: I1b933b8be7acbca1f1043a374a7cafb95aa9ffde Reviewed-on: https://webrtc-review.googlesource.com/c/111249 Reviewed-by: Karl Wiberg Commit-Queue: Fredrik Solenberg Cr-Commit-Position: refs/heads/master@{#25688} --- BUILD.gn | 1 - audio/channel_receive.h | 1 + common_types.h | 75 ------------------ modules/audio_coding/BUILD.gn | 1 + modules/audio_coding/acm2/call_statistics.h | 2 +- .../include/audio_coding_module_typedefs.h | 76 +++++++++++++++++++ 6 files changed, 79 insertions(+), 77 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 5e0503d30e..4deafefac0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -440,7 +440,6 @@ rtc_source_set("webrtc_common") { "api:array_view", "api/video:video_bitrate_allocation", "rtc_base:checks", - "rtc_base:deprecation", "//third_party/abseil-cpp/absl/strings", ] diff --git a/audio/channel_receive.h b/audio/channel_receive.h index ffdd196b99..c774875ab2 100644 --- a/audio/channel_receive.h +++ b/audio/channel_receive.h @@ -26,6 +26,7 @@ #include "call/rtp_packet_sink_interface.h" #include "call/syncable.h" #include "common_types.h" // NOLINT(build/include) +#include "modules/audio_coding/include/audio_coding_module.h" // TODO(solenberg, nisse): This file contains a few NOLINT marks, to silence // warnings about use of unsigned short. diff --git a/common_types.h b/common_types.h index b2fcf17a48..ffd19b7187 100644 --- a/common_types.h +++ b/common_types.h @@ -18,7 +18,6 @@ // TODO(sprang): Remove this include when all usage includes it directly. #include "api/video/video_bitrate_allocation.h" #include "rtc_base/checks.h" -#include "rtc_base/deprecation.h" #if defined(_MSC_VER) // Disable "new behavior: elements of array will be default initialized" @@ -206,80 +205,6 @@ struct CodecInst { // RTP enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13 -// NETEQ statistics. -struct NetworkStatistics { - // current jitter buffer size in ms - uint16_t currentBufferSize; - // preferred (optimal) buffer size in ms - uint16_t preferredBufferSize; - // adding extra delay due to "peaky jitter" - bool jitterPeaksFound; - // Stats below correspond to similarly-named fields in the WebRTC stats spec. - // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats - uint64_t totalSamplesReceived; - uint64_t concealedSamples; - uint64_t concealmentEvents; - uint64_t jitterBufferDelayMs; - // Stats below DO NOT correspond directly to anything in the WebRTC stats - // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. - uint16_t currentPacketLossRate; - // Late loss rate; fraction between 0 and 1, scaled to Q14. - union { - RTC_DEPRECATED uint16_t currentDiscardRate; - }; - // fraction (of original stream) of synthesized audio inserted through - // expansion (in Q14) - uint16_t currentExpandRate; - // fraction (of original stream) of synthesized speech inserted through - // expansion (in Q14) - uint16_t currentSpeechExpandRate; - // fraction of synthesized speech inserted through pre-emptive expansion - // (in Q14) - uint16_t currentPreemptiveRate; - // fraction of data removed through acceleration (in Q14) - uint16_t currentAccelerateRate; - // fraction of data coming from secondary decoding (in Q14) - uint16_t currentSecondaryDecodedRate; - // Fraction of secondary data, including FEC and RED, that is discarded (in - // Q14). Discarding of secondary data can be caused by the reception of the - // primary data, obsoleting the secondary data. It can also be caused by early - // or late arrival of secondary data. - uint16_t currentSecondaryDiscardedRate; - // clock-drift in parts-per-million (negative or positive) - int32_t clockDriftPPM; - // average packet waiting time in the jitter buffer (ms) - int meanWaitingTimeMs; - // median packet waiting time in the jitter buffer (ms) - int medianWaitingTimeMs; - // min packet waiting time in the jitter buffer (ms) - int minWaitingTimeMs; - // max packet waiting time in the jitter buffer (ms) - int maxWaitingTimeMs; - // added samples in off mode due to packet loss - size_t addedSamples; -}; - -// Statistics for calls to AudioCodingModule::PlayoutData10Ms(). -struct AudioDecodingCallStats { - AudioDecodingCallStats() - : calls_to_silence_generator(0), - calls_to_neteq(0), - decoded_normal(0), - decoded_plc(0), - decoded_cng(0), - decoded_plc_cng(0), - decoded_muted_output(0) {} - - int calls_to_silence_generator; // Number of calls where silence generated, - // and NetEq was disengaged from decoding. - int calls_to_neteq; // Number of calls to NetEq. - int decoded_normal; // Number of calls where audio RTP packet decoded. - int decoded_plc; // Number of calls resulted in PLC. - int decoded_cng; // Number of calls where comfort noise generated due to DTX. - int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. - int decoded_muted_output; // Number of calls returning a muted state output. -}; - // ================================================================== // Video specific types // ================================================================== diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn index bc82751872..5163d16e0a 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -67,6 +67,7 @@ rtc_source_set("audio_coding_module_typedefs") { ] deps = [ "../..:webrtc_common", + "../../rtc_base:deprecation", ] } diff --git a/modules/audio_coding/acm2/call_statistics.h b/modules/audio_coding/acm2/call_statistics.h index 9dced6475a..5d94ac4538 100644 --- a/modules/audio_coding/acm2/call_statistics.h +++ b/modules/audio_coding/acm2/call_statistics.h @@ -12,7 +12,7 @@ #define MODULES_AUDIO_CODING_ACM2_CALL_STATISTICS_H_ #include "api/audio/audio_frame.h" -#include "common_types.h" // NOLINT(build/include) +#include "modules/audio_coding/include/audio_coding_module_typedefs.h" // // This class is for book keeping of calls to ACM. It is not useful to log API diff --git a/modules/audio_coding/include/audio_coding_module_typedefs.h b/modules/audio_coding/include/audio_coding_module_typedefs.h index cd4351b07f..8946afd1a3 100644 --- a/modules/audio_coding/include/audio_coding_module_typedefs.h +++ b/modules/audio_coding/include/audio_coding_module_typedefs.h @@ -13,6 +13,8 @@ #include +#include "rtc_base/deprecation.h" + namespace webrtc { /////////////////////////////////////////////////////////////////////////// @@ -43,6 +45,80 @@ enum OpusApplicationMode { kAudio = 1, }; +// Statistics for calls to AudioCodingModule::PlayoutData10Ms(). +struct AudioDecodingCallStats { + AudioDecodingCallStats() + : calls_to_silence_generator(0), + calls_to_neteq(0), + decoded_normal(0), + decoded_plc(0), + decoded_cng(0), + decoded_plc_cng(0), + decoded_muted_output(0) {} + + int calls_to_silence_generator; // Number of calls where silence generated, + // and NetEq was disengaged from decoding. + int calls_to_neteq; // Number of calls to NetEq. + int decoded_normal; // Number of calls where audio RTP packet decoded. + int decoded_plc; // Number of calls resulted in PLC. + int decoded_cng; // Number of calls where comfort noise generated due to DTX. + int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. + int decoded_muted_output; // Number of calls returning a muted state output. +}; + +// NETEQ statistics. +struct NetworkStatistics { + // current jitter buffer size in ms + uint16_t currentBufferSize; + // preferred (optimal) buffer size in ms + uint16_t preferredBufferSize; + // adding extra delay due to "peaky jitter" + bool jitterPeaksFound; + // Stats below correspond to similarly-named fields in the WebRTC stats spec. + // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats + uint64_t totalSamplesReceived; + uint64_t concealedSamples; + uint64_t concealmentEvents; + uint64_t jitterBufferDelayMs; + // Stats below DO NOT correspond directly to anything in the WebRTC stats + // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. + uint16_t currentPacketLossRate; + // Late loss rate; fraction between 0 and 1, scaled to Q14. + union { + RTC_DEPRECATED uint16_t currentDiscardRate; + }; + // fraction (of original stream) of synthesized audio inserted through + // expansion (in Q14) + uint16_t currentExpandRate; + // fraction (of original stream) of synthesized speech inserted through + // expansion (in Q14) + uint16_t currentSpeechExpandRate; + // fraction of synthesized speech inserted through pre-emptive expansion + // (in Q14) + uint16_t currentPreemptiveRate; + // fraction of data removed through acceleration (in Q14) + uint16_t currentAccelerateRate; + // fraction of data coming from secondary decoding (in Q14) + uint16_t currentSecondaryDecodedRate; + // Fraction of secondary data, including FEC and RED, that is discarded (in + // Q14). Discarding of secondary data can be caused by the reception of the + // primary data, obsoleting the secondary data. It can also be caused by early + // or late arrival of secondary data. + uint16_t currentSecondaryDiscardedRate; + // clock-drift in parts-per-million (negative or positive) + int32_t clockDriftPPM; + // average packet waiting time in the jitter buffer (ms) + int meanWaitingTimeMs; + // median packet waiting time in the jitter buffer (ms) + int medianWaitingTimeMs; + // min packet waiting time in the jitter buffer (ms) + int minWaitingTimeMs; + // max packet waiting time in the jitter buffer (ms) + int maxWaitingTimeMs; + // added samples in off mode due to packet loss + size_t addedSamples; +}; + } // namespace webrtc #endif // MODULES_AUDIO_CODING_INCLUDE_AUDIO_CODING_MODULE_TYPEDEFS_H_