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-rtcinboundrtpstreamstats 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 uint64_t insertedSamplesForDeceleration; 94 uint64_t removedSamplesForAcceleration; 95 uint64_t fecPacketsReceived; 96 uint64_t fecPacketsDiscarded; 97 // Stats below correspond to similarly-named fields in the WebRTC stats spec. 98 // https://w3c.github.io/webrtc-stats/#dom-rtcreceivedrtpstreamstats 99 uint64_t packetsDiscarded; 100 // Non standard stats propagated to spec complaint GetStats API. 101 uint64_t jitterBufferTargetDelayMs; 102 // Stats below DO NOT correspond directly to anything in the WebRTC stats 103 // fraction (of original stream) of synthesized audio inserted through 104 // expansion (in Q14) 105 uint16_t currentExpandRate; 106 // fraction (of original stream) of synthesized speech inserted through 107 // expansion (in Q14) 108 uint16_t currentSpeechExpandRate; 109 // fraction of synthesized speech inserted through pre-emptive expansion 110 // (in Q14) 111 uint16_t currentPreemptiveRate; 112 // fraction of data removed through acceleration (in Q14) 113 uint16_t currentAccelerateRate; 114 // fraction of data coming from secondary decoding (in Q14) 115 uint16_t currentSecondaryDecodedRate; 116 // Fraction of secondary data, including FEC and RED, that is discarded (in 117 // Q14). Discarding of secondary data can be caused by the reception of the 118 // primary data, obsoleting the secondary data. It can also be caused by early 119 // or late arrival of secondary data. 120 uint16_t currentSecondaryDiscardedRate; 121 // average packet waiting time in the jitter buffer (ms) 122 int meanWaitingTimeMs; 123 // median packet waiting time in the jitter buffer (ms) 124 int medianWaitingTimeMs; 125 // min packet waiting time in the jitter buffer (ms) 126 int minWaitingTimeMs; 127 // max packet waiting time in the jitter buffer (ms) 128 int maxWaitingTimeMs; 129 // count of the number of buffer flushes 130 uint64_t packetBufferFlushes; 131 // number of samples expanded due to delayed packets 132 uint64_t delayedPacketOutageSamples; 133 // arrival delay of incoming packets 134 uint64_t relativePacketArrivalDelayMs; 135 // number of audio interruptions 136 int32_t interruptionCount; 137 // total duration of audio interruptions 138 int32_t totalInterruptionDurationMs; 139 }; 140 141 } // namespace webrtc 142 143 #endif // MODULES_AUDIO_CODING_INCLUDE_AUDIO_CODING_MODULE_TYPEDEFS_H_ 144