1 /* 2 * Copyright (c) 2011 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_CODING_INCLUDE_AUDIO_CODING_MODULE_TYPEDEFS_H_ 12 #define MODULES_AUDIO_CODING_INCLUDE_AUDIO_CODING_MODULE_TYPEDEFS_H_ 13 14 #include <map> 15 16 #include "rtc_base/deprecation.h" 17 18 namespace webrtc { 19 20 /////////////////////////////////////////////////////////////////////////// 21 // enum ACMVADMode 22 // An enumerator for aggressiveness of VAD 23 // -VADNormal : least aggressive mode. 24 // -VADLowBitrate : more aggressive than "VADNormal" to save on 25 // bit-rate. 26 // -VADAggr : an aggressive mode. 27 // -VADVeryAggr : the most agressive mode. 28 // 29 enum ACMVADMode { 30 VADNormal = 0, 31 VADLowBitrate = 1, 32 VADAggr = 2, 33 VADVeryAggr = 3 34 }; 35 36 enum class AudioFrameType { 37 kEmptyFrame = 0, 38 kAudioFrameSpeech = 1, 39 kAudioFrameCN = 2, 40 }; 41 42 /////////////////////////////////////////////////////////////////////////// 43 // 44 // Enumeration of Opus mode for intended application. 45 // 46 // kVoip : optimized for voice signals. 47 // kAudio : optimized for non-voice signals like music. 48 // 49 enum OpusApplicationMode { 50 kVoip = 0, 51 kAudio = 1, 52 }; 53 54 // Statistics for calls to AudioCodingModule::PlayoutData10Ms(). 55 struct AudioDecodingCallStats { AudioDecodingCallStatsAudioDecodingCallStats56 AudioDecodingCallStats() 57 : calls_to_silence_generator(0), 58 calls_to_neteq(0), 59 decoded_normal(0), 60 decoded_neteq_plc(0), 61 decoded_codec_plc(0), 62 decoded_cng(0), 63 decoded_plc_cng(0), 64 decoded_muted_output(0) {} 65 66 int calls_to_silence_generator; // Number of calls where silence generated, 67 // and NetEq was disengaged from decoding. 68 int calls_to_neteq; // Number of calls to NetEq. 69 int decoded_normal; // Number of calls where audio RTP packet decoded. 70 int decoded_neteq_plc; // Number of calls resulted in NetEq PLC. 71 int decoded_codec_plc; // Number of calls resulted in codec PLC. 72 int decoded_cng; // Number of calls where comfort noise generated due to DTX. 73 int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. 74 int decoded_muted_output; // Number of calls returning a muted state output. 75 }; 76 77 // NETEQ statistics. 78 struct NetworkStatistics { 79 // current jitter buffer size in ms 80 uint16_t currentBufferSize; 81 // preferred (optimal) buffer size in ms 82 uint16_t preferredBufferSize; 83 // adding extra delay due to "peaky jitter" 84 bool jitterPeaksFound; 85 // Stats below correspond to similarly-named fields in the WebRTC stats spec. 86 // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats 87 uint64_t totalSamplesReceived; 88 uint64_t concealedSamples; 89 uint64_t silentConcealedSamples; 90 uint64_t concealmentEvents; 91 uint64_t jitterBufferDelayMs; 92 uint64_t jitterBufferEmittedCount; 93 // Non standard stats propagated to spec complaint GetStats API. 94 uint64_t jitterBufferTargetDelayMs; 95 uint64_t insertedSamplesForDeceleration; 96 uint64_t removedSamplesForAcceleration; 97 uint64_t fecPacketsReceived; 98 uint64_t fecPacketsDiscarded; 99 // Stats below DO NOT correspond directly to anything in the WebRTC stats 100 // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. 101 uint16_t currentPacketLossRate; 102 // Late loss rate; fraction between 0 and 1, scaled to Q14. 103 union { 104 RTC_DEPRECATED uint16_t currentDiscardRate; 105 }; 106 // fraction (of original stream) of synthesized audio inserted through 107 // expansion (in Q14) 108 uint16_t currentExpandRate; 109 // fraction (of original stream) of synthesized speech inserted through 110 // expansion (in Q14) 111 uint16_t currentSpeechExpandRate; 112 // fraction of synthesized speech inserted through pre-emptive expansion 113 // (in Q14) 114 uint16_t currentPreemptiveRate; 115 // fraction of data removed through acceleration (in Q14) 116 uint16_t currentAccelerateRate; 117 // fraction of data coming from secondary decoding (in Q14) 118 uint16_t currentSecondaryDecodedRate; 119 // Fraction of secondary data, including FEC and RED, that is discarded (in 120 // Q14). Discarding of secondary data can be caused by the reception of the 121 // primary data, obsoleting the secondary data. It can also be caused by early 122 // or late arrival of secondary data. 123 uint16_t currentSecondaryDiscardedRate; 124 // average packet waiting time in the jitter buffer (ms) 125 int meanWaitingTimeMs; 126 // median packet waiting time in the jitter buffer (ms) 127 int medianWaitingTimeMs; 128 // min packet waiting time in the jitter buffer (ms) 129 int minWaitingTimeMs; 130 // max packet waiting time in the jitter buffer (ms) 131 int maxWaitingTimeMs; 132 // added samples in off mode due to packet loss 133 size_t addedSamples; 134 // count of the number of buffer flushes 135 uint64_t packetBufferFlushes; 136 // number of samples expanded due to delayed packets 137 uint64_t delayedPacketOutageSamples; 138 // arrival delay of incoming packets 139 uint64_t relativePacketArrivalDelayMs; 140 // number of audio interruptions 141 int32_t interruptionCount; 142 // total duration of audio interruptions 143 int32_t totalInterruptionDurationMs; 144 }; 145 146 } // namespace webrtc 147 148 #endif // MODULES_AUDIO_CODING_INCLUDE_AUDIO_CODING_MODULE_TYPEDEFS_H_ 149