niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 1 | /* |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 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 | |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 11 | #ifndef WEBRTC_COMMON_TYPES_H_ |
| 12 | #define WEBRTC_COMMON_TYPES_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 13 | |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 14 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 15 | |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 16 | #if defined(_MSC_VER) |
| 17 | // Disable "new behavior: elements of array will be default initialized" |
| 18 | // warning. Affects OverUseDetectorOptions. |
| 19 | #pragma warning(disable:4351) |
| 20 | #endif |
| 21 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 22 | #ifdef WEBRTC_EXPORT |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 23 | #define WEBRTC_DLLEXPORT _declspec(dllexport) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 24 | #elif WEBRTC_DLL |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 25 | #define WEBRTC_DLLEXPORT _declspec(dllimport) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 26 | #else |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 27 | #define WEBRTC_DLLEXPORT |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 28 | #endif |
| 29 | |
| 30 | #ifndef NULL |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 31 | #define NULL 0 |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 32 | #endif |
| 33 | |
henrika@webrtc.org | f75901f | 2012-01-16 08:45:42 | [diff] [blame] | 34 | #define RTP_PAYLOAD_NAME_SIZE 32 |
| 35 | |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 36 | #if defined(WEBRTC_WIN) |
| 37 | // Compares two strings without regard to case. |
| 38 | #define STR_CASE_CMP(s1, s2) ::_stricmp(s1, s2) |
| 39 | // Compares characters of two strings without regard to case. |
| 40 | #define STR_NCASE_CMP(s1, s2, n) ::_strnicmp(s1, s2, n) |
| 41 | #else |
| 42 | #define STR_CASE_CMP(s1, s2) ::strcasecmp(s1, s2) |
| 43 | #define STR_NCASE_CMP(s1, s2, n) ::strncasecmp(s1, s2, n) |
| 44 | #endif |
| 45 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 46 | namespace webrtc { |
| 47 | |
andresp@webrtc.org | 185bae4 | 2013-05-14 08:02:25 | [diff] [blame] | 48 | class Config; |
| 49 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 50 | class InStream |
| 51 | { |
| 52 | public: |
| 53 | virtual int Read(void *buf,int len) = 0; |
| 54 | virtual int Rewind() {return -1;} |
| 55 | virtual ~InStream() {} |
| 56 | protected: |
| 57 | InStream() {} |
| 58 | }; |
| 59 | |
| 60 | class OutStream |
| 61 | { |
| 62 | public: |
| 63 | virtual bool Write(const void *buf,int len) = 0; |
| 64 | virtual int Rewind() {return -1;} |
| 65 | virtual ~OutStream() {} |
| 66 | protected: |
| 67 | OutStream() {} |
| 68 | }; |
| 69 | |
| 70 | enum TraceModule |
| 71 | { |
andrew@webrtc.org | 50419b0 | 2012-11-14 19:07:54 | [diff] [blame] | 72 | kTraceUndefined = 0, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 73 | // not a module, triggered from the engine code |
| 74 | kTraceVoice = 0x0001, |
| 75 | // not a module, triggered from the engine code |
| 76 | kTraceVideo = 0x0002, |
| 77 | // not a module, triggered from the utility code |
| 78 | kTraceUtility = 0x0003, |
| 79 | kTraceRtpRtcp = 0x0004, |
| 80 | kTraceTransport = 0x0005, |
| 81 | kTraceSrtp = 0x0006, |
| 82 | kTraceAudioCoding = 0x0007, |
| 83 | kTraceAudioMixerServer = 0x0008, |
| 84 | kTraceAudioMixerClient = 0x0009, |
| 85 | kTraceFile = 0x000a, |
| 86 | kTraceAudioProcessing = 0x000b, |
| 87 | kTraceVideoCoding = 0x0010, |
| 88 | kTraceVideoMixer = 0x0011, |
| 89 | kTraceAudioDevice = 0x0012, |
| 90 | kTraceVideoRenderer = 0x0014, |
| 91 | kTraceVideoCapture = 0x0015, |
| 92 | kTraceVideoPreocessing = 0x0016 |
| 93 | }; |
| 94 | |
| 95 | enum TraceLevel |
| 96 | { |
| 97 | kTraceNone = 0x0000, // no trace |
| 98 | kTraceStateInfo = 0x0001, |
| 99 | kTraceWarning = 0x0002, |
| 100 | kTraceError = 0x0004, |
| 101 | kTraceCritical = 0x0008, |
| 102 | kTraceApiCall = 0x0010, |
| 103 | kTraceDefault = 0x00ff, |
| 104 | |
| 105 | kTraceModuleCall = 0x0020, |
| 106 | kTraceMemory = 0x0100, // memory info |
| 107 | kTraceTimer = 0x0200, // timing info |
| 108 | kTraceStream = 0x0400, // "continuous" stream of data |
| 109 | |
| 110 | // used for debug purposes |
| 111 | kTraceDebug = 0x0800, // debug |
| 112 | kTraceInfo = 0x1000, // debug info |
| 113 | |
andrew@webrtc.org | 655d8f5 | 2012-11-20 07:34:45 | [diff] [blame] | 114 | // Non-verbose level used by LS_INFO of logging.h. Do not use directly. |
| 115 | kTraceTerseInfo = 0x2000, |
| 116 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 117 | kTraceAll = 0xffff |
| 118 | }; |
| 119 | |
| 120 | // External Trace API |
andrew@webrtc.org | 23ec30b | 2012-11-15 05:33:25 | [diff] [blame] | 121 | class TraceCallback { |
| 122 | public: |
| 123 | virtual void Print(TraceLevel level, const char* message, int length) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 124 | |
andrew@webrtc.org | 23ec30b | 2012-11-15 05:33:25 | [diff] [blame] | 125 | protected: |
| 126 | virtual ~TraceCallback() {} |
| 127 | TraceCallback() {} |
| 128 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 129 | |
| 130 | enum FileFormats |
| 131 | { |
| 132 | kFileFormatWavFile = 1, |
| 133 | kFileFormatCompressedFile = 2, |
| 134 | kFileFormatAviFile = 3, |
| 135 | kFileFormatPreencodedFile = 4, |
| 136 | kFileFormatPcm16kHzFile = 7, |
| 137 | kFileFormatPcm8kHzFile = 8, |
| 138 | kFileFormatPcm32kHzFile = 9 |
| 139 | }; |
| 140 | |
| 141 | |
| 142 | enum ProcessingTypes |
| 143 | { |
| 144 | kPlaybackPerChannel = 0, |
| 145 | kPlaybackAllChannelsMixed, |
| 146 | kRecordingPerChannel, |
andrew@webrtc.org | 21ab3ba | 2012-10-19 17:30:56 | [diff] [blame] | 147 | kRecordingAllChannelsMixed, |
| 148 | kRecordingPreprocessing |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 149 | }; |
| 150 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 151 | // Interface for encrypting and decrypting regular data and rtp/rtcp packets. |
| 152 | // Implement this interface if you wish to provide an encryption scheme to |
| 153 | // the voice or video engines. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 154 | class Encryption |
| 155 | { |
| 156 | public: |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 157 | // Encrypt the given data. |
| 158 | // |
| 159 | // Args: |
| 160 | // channel: The channel to encrypt data for. |
| 161 | // in_data: The data to encrypt. This data is bytes_in bytes long. |
| 162 | // out_data: The buffer to write the encrypted data to. You may write more |
| 163 | // bytes of encrypted data than what you got as input, up to a maximum |
| 164 | // of webrtc::kViEMaxMtu if you are encrypting in the video engine, or |
| 165 | // webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine. |
| 166 | // bytes_in: The number of bytes in the input buffer. |
| 167 | // bytes_out: The number of bytes written in out_data. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 168 | virtual void encrypt( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 169 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 170 | unsigned char* in_data, |
| 171 | unsigned char* out_data, |
| 172 | int bytes_in, |
| 173 | int* bytes_out) = 0; |
| 174 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 175 | // Decrypts the given data. This should reverse the effects of encrypt(). |
| 176 | // |
| 177 | // Args: |
| 178 | // channel_no: The channel to decrypt data for. |
| 179 | // in_data: The data to decrypt. This data is bytes_in bytes long. |
| 180 | // out_data: The buffer to write the decrypted data to. You may write more |
| 181 | // bytes of decrypted data than what you got as input, up to a maximum |
| 182 | // of webrtc::kViEMaxMtu if you are encrypting in the video engine, or |
| 183 | // webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine. |
| 184 | // bytes_in: The number of bytes in the input buffer. |
| 185 | // bytes_out: The number of bytes written in out_data. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 186 | virtual void decrypt( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 187 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 188 | unsigned char* in_data, |
| 189 | unsigned char* out_data, |
| 190 | int bytes_in, |
| 191 | int* bytes_out) = 0; |
| 192 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 193 | // Encrypts a RTCP packet. Otherwise, this method has the same contract as |
| 194 | // encrypt(). |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 195 | virtual void encrypt_rtcp( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 196 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 197 | unsigned char* in_data, |
| 198 | unsigned char* out_data, |
| 199 | int bytes_in, |
| 200 | int* bytes_out) = 0; |
| 201 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 202 | // Decrypts a RTCP packet. Otherwise, this method has the same contract as |
| 203 | // decrypt(). |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 204 | virtual void decrypt_rtcp( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 205 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 206 | unsigned char* in_data, |
| 207 | unsigned char* out_data, |
| 208 | int bytes_in, |
| 209 | int* bytes_out) = 0; |
| 210 | |
| 211 | protected: |
| 212 | virtual ~Encryption() {} |
| 213 | Encryption() {} |
| 214 | }; |
| 215 | |
| 216 | // External transport callback interface |
| 217 | class Transport |
| 218 | { |
| 219 | public: |
| 220 | virtual int SendPacket(int channel, const void *data, int len) = 0; |
| 221 | virtual int SendRTCPPacket(int channel, const void *data, int len) = 0; |
| 222 | |
| 223 | protected: |
| 224 | virtual ~Transport() {} |
| 225 | Transport() {} |
| 226 | }; |
| 227 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame^] | 228 | // Statistics for an RTCP channel |
sprang@webrtc.org | fe5d36b | 2013-10-28 09:21:07 | [diff] [blame] | 229 | struct RtcpStatistics { |
| 230 | public: |
| 231 | RtcpStatistics() |
| 232 | : fraction_lost(0), |
| 233 | cumulative_lost(0), |
| 234 | extended_max_sequence_number(0), |
| 235 | jitter(0), |
| 236 | max_jitter(0) {} |
| 237 | |
| 238 | uint8_t fraction_lost; |
| 239 | uint32_t cumulative_lost; |
| 240 | uint32_t extended_max_sequence_number; |
| 241 | uint32_t jitter; |
| 242 | uint32_t max_jitter; |
| 243 | }; |
| 244 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame^] | 245 | // Callback, called whenever a new rtcp report block is transmitted. |
| 246 | class RtcpStatisticsCallback { |
| 247 | public: |
| 248 | virtual ~RtcpStatisticsCallback() {} |
| 249 | |
| 250 | virtual void StatisticsUpdated(const RtcpStatistics& statistics, |
| 251 | uint32_t ssrc) = 0; |
| 252 | }; |
| 253 | |
| 254 | // Data usage statistics for a (rtp) stream |
| 255 | struct StreamDataCounters { |
| 256 | public: |
| 257 | StreamDataCounters() |
| 258 | : bytes(0), |
| 259 | padding_bytes(0), |
| 260 | packets(0), |
| 261 | retransmitted_packets(0), |
| 262 | fec_packets(0) {} |
| 263 | |
| 264 | uint32_t bytes; |
| 265 | uint32_t padding_bytes; |
| 266 | uint32_t packets; |
| 267 | uint32_t retransmitted_packets; |
| 268 | uint32_t fec_packets; |
| 269 | }; |
| 270 | |
| 271 | // Callback, called whenever byte/packet counts have been updated. |
| 272 | class StreamDataCountersCallback { |
| 273 | public: |
| 274 | virtual ~StreamDataCountersCallback() {} |
| 275 | |
| 276 | virtual void DataCountersUpdated(const StreamDataCounters& counters, |
| 277 | uint32_t ssrc) = 0; |
| 278 | }; |
| 279 | |
| 280 | // Rate statistics for a stream |
| 281 | struct BitrateStatistics { |
| 282 | public: |
| 283 | BitrateStatistics() |
| 284 | : bitrate_(0), |
| 285 | packet_rate(0), |
| 286 | now(0) {} |
| 287 | |
| 288 | uint32_t bitrate_; |
| 289 | uint32_t packet_rate; |
| 290 | uint64_t now; |
| 291 | }; |
| 292 | |
| 293 | // Callback, used to notify an observer whenever new rates have been estimated. |
| 294 | class BitrateStatisticsObserver { |
| 295 | public: |
| 296 | virtual ~BitrateStatisticsObserver() {} |
| 297 | |
| 298 | virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) = 0; |
| 299 | }; |
| 300 | |
| 301 | // Callback, used to notify an observer whenever frame counts have been updated |
| 302 | class FrameCountObserver { |
| 303 | public: |
| 304 | ~FrameCountObserver() {} |
| 305 | virtual void Notify(const unsigned int key_frames, |
| 306 | const unsigned int delta_frames, |
| 307 | const unsigned int ssrc) = 0; |
| 308 | }; |
| 309 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 310 | // ================================================================== |
| 311 | // Voice specific types |
| 312 | // ================================================================== |
| 313 | |
| 314 | // Each codec supported can be described by this structure. |
| 315 | struct CodecInst |
| 316 | { |
| 317 | int pltype; |
henrika@webrtc.org | f75901f | 2012-01-16 08:45:42 | [diff] [blame] | 318 | char plname[RTP_PAYLOAD_NAME_SIZE]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 319 | int plfreq; |
| 320 | int pacsize; |
| 321 | int channels; |
fischman@webrtc.org | 678cf29 | 2013-07-23 18:32:10 | [diff] [blame] | 322 | int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file! |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 323 | }; |
| 324 | |
| 325 | enum FrameType |
| 326 | { |
| 327 | kFrameEmpty = 0, |
| 328 | kAudioFrameSpeech = 1, |
| 329 | kAudioFrameCN = 2, |
| 330 | kVideoFrameKey = 3, // independent frame |
| 331 | kVideoFrameDelta = 4, // depends on the previus frame |
| 332 | kVideoFrameGolden = 5, // depends on a old known previus frame |
| 333 | kVideoFrameAltRef = 6 |
| 334 | }; |
| 335 | |
| 336 | // RTP |
| 337 | enum {kRtpCsrcSize = 15}; // RFC 3550 page 13 |
| 338 | |
| 339 | enum RTPDirections |
| 340 | { |
| 341 | kRtpIncoming = 0, |
| 342 | kRtpOutgoing |
| 343 | }; |
| 344 | |
| 345 | enum PayloadFrequencies |
| 346 | { |
| 347 | kFreq8000Hz = 8000, |
| 348 | kFreq16000Hz = 16000, |
| 349 | kFreq32000Hz = 32000 |
| 350 | }; |
| 351 | |
| 352 | enum VadModes // degree of bandwidth reduction |
| 353 | { |
| 354 | kVadConventional = 0, // lowest reduction |
| 355 | kVadAggressiveLow, |
| 356 | kVadAggressiveMid, |
| 357 | kVadAggressiveHigh // highest reduction |
| 358 | }; |
| 359 | |
| 360 | struct NetworkStatistics // NETEQ statistics |
| 361 | { |
| 362 | // current jitter buffer size in ms |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 363 | uint16_t currentBufferSize; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 364 | // preferred (optimal) buffer size in ms |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 365 | uint16_t preferredBufferSize; |
henrik.lundin@webrtc.org | d439870 | 2012-01-04 13:09:55 | [diff] [blame] | 366 | // adding extra delay due to "peaky jitter" |
| 367 | bool jitterPeaksFound; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 368 | // loss rate (network + late) in percent (in Q14) |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 369 | uint16_t currentPacketLossRate; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 370 | // late loss rate in percent (in Q14) |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 371 | uint16_t currentDiscardRate; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 372 | // fraction (of original stream) of synthesized speech inserted through |
| 373 | // expansion (in Q14) |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 374 | uint16_t currentExpandRate; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 375 | // fraction of synthesized speech inserted through pre-emptive expansion |
| 376 | // (in Q14) |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 377 | uint16_t currentPreemptiveRate; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 378 | // fraction of data removed through acceleration (in Q14) |
pbos@webrtc.org | 77f6b21 | 2013-05-03 12:02:11 | [diff] [blame] | 379 | uint16_t currentAccelerateRate; |
henrik.lundin@webrtc.org | d439870 | 2012-01-04 13:09:55 | [diff] [blame] | 380 | // clock-drift in parts-per-million (negative or positive) |
| 381 | int32_t clockDriftPPM; |
henrik.lundin@webrtc.org | dbba1f9 | 2011-12-20 15:45:05 | [diff] [blame] | 382 | // average packet waiting time in the jitter buffer (ms) |
| 383 | int meanWaitingTimeMs; |
| 384 | // median packet waiting time in the jitter buffer (ms) |
| 385 | int medianWaitingTimeMs; |
henrik.lundin@webrtc.org | 053c799 | 2012-01-12 14:16:44 | [diff] [blame] | 386 | // min packet waiting time in the jitter buffer (ms) |
| 387 | int minWaitingTimeMs; |
henrik.lundin@webrtc.org | dbba1f9 | 2011-12-20 15:45:05 | [diff] [blame] | 388 | // max packet waiting time in the jitter buffer (ms) |
| 389 | int maxWaitingTimeMs; |
roosa@google.com | b8ba4d8 | 2012-12-14 00:06:18 | [diff] [blame] | 390 | // added samples in off mode due to packet loss |
| 391 | int addedSamples; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 392 | }; |
| 393 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 394 | typedef struct |
| 395 | { |
| 396 | int min; // minumum |
| 397 | int max; // maximum |
| 398 | int average; // average |
| 399 | } StatVal; |
| 400 | |
| 401 | typedef struct // All levels are reported in dBm0 |
| 402 | { |
| 403 | StatVal speech_rx; // long-term speech levels on receiving side |
| 404 | StatVal speech_tx; // long-term speech levels on transmitting side |
| 405 | StatVal noise_rx; // long-term noise/silence levels on receiving side |
| 406 | StatVal noise_tx; // long-term noise/silence levels on transmitting side |
| 407 | } LevelStatistics; |
| 408 | |
| 409 | typedef struct // All levels are reported in dB |
| 410 | { |
| 411 | StatVal erl; // Echo Return Loss |
| 412 | StatVal erle; // Echo Return Loss Enhancement |
| 413 | StatVal rerl; // RERL = ERL + ERLE |
| 414 | // Echo suppression inside EC at the point just before its NLP |
| 415 | StatVal a_nlp; |
| 416 | } EchoStatistics; |
| 417 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 418 | enum NsModes // type of Noise Suppression |
| 419 | { |
| 420 | kNsUnchanged = 0, // previously set mode |
| 421 | kNsDefault, // platform default |
| 422 | kNsConference, // conferencing default |
| 423 | kNsLowSuppression, // lowest suppression |
| 424 | kNsModerateSuppression, |
| 425 | kNsHighSuppression, |
| 426 | kNsVeryHighSuppression, // highest suppression |
| 427 | }; |
| 428 | |
| 429 | enum AgcModes // type of Automatic Gain Control |
| 430 | { |
| 431 | kAgcUnchanged = 0, // previously set mode |
| 432 | kAgcDefault, // platform default |
| 433 | // adaptive mode for use when analog volume control exists (e.g. for |
| 434 | // PC softphone) |
| 435 | kAgcAdaptiveAnalog, |
| 436 | // scaling takes place in the digital domain (e.g. for conference servers |
| 437 | // and embedded devices) |
| 438 | kAgcAdaptiveDigital, |
andrew@webrtc.org | 8012474 | 2012-03-08 17:54:24 | [diff] [blame] | 439 | // can be used on embedded devices where the capture signal level |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 440 | // is predictable |
| 441 | kAgcFixedDigital |
| 442 | }; |
| 443 | |
| 444 | // EC modes |
| 445 | enum EcModes // type of Echo Control |
| 446 | { |
| 447 | kEcUnchanged = 0, // previously set mode |
| 448 | kEcDefault, // platform default |
| 449 | kEcConference, // conferencing default (aggressive AEC) |
| 450 | kEcAec, // Acoustic Echo Cancellation |
| 451 | kEcAecm, // AEC mobile |
| 452 | }; |
| 453 | |
| 454 | // AECM modes |
| 455 | enum AecmModes // mode of AECM |
| 456 | { |
| 457 | kAecmQuietEarpieceOrHeadset = 0, |
| 458 | // Quiet earpiece or headset use |
| 459 | kAecmEarpiece, // most earpiece use |
| 460 | kAecmLoudEarpiece, // Loud earpiece or quiet speakerphone use |
| 461 | kAecmSpeakerphone, // most speakerphone use (default) |
| 462 | kAecmLoudSpeakerphone // Loud speakerphone |
| 463 | }; |
| 464 | |
| 465 | // AGC configuration |
| 466 | typedef struct |
| 467 | { |
| 468 | unsigned short targetLeveldBOv; |
| 469 | unsigned short digitalCompressionGaindB; |
| 470 | bool limiterEnable; |
| 471 | } AgcConfig; // AGC configuration parameters |
| 472 | |
| 473 | enum StereoChannel |
| 474 | { |
| 475 | kStereoLeft = 0, |
| 476 | kStereoRight, |
| 477 | kStereoBoth |
| 478 | }; |
| 479 | |
| 480 | // Audio device layers |
| 481 | enum AudioLayers |
| 482 | { |
| 483 | kAudioPlatformDefault = 0, |
| 484 | kAudioWindowsWave = 1, |
| 485 | kAudioWindowsCore = 2, |
| 486 | kAudioLinuxAlsa = 3, |
| 487 | kAudioLinuxPulse = 4 |
| 488 | }; |
| 489 | |
| 490 | enum NetEqModes // NetEQ playout configurations |
| 491 | { |
| 492 | // Optimized trade-off between low delay and jitter robustness for two-way |
| 493 | // communication. |
| 494 | kNetEqDefault = 0, |
| 495 | // Improved jitter robustness at the cost of increased delay. Can be |
| 496 | // used in one-way communication. |
| 497 | kNetEqStreaming = 1, |
| 498 | // Optimzed for decodability of fax signals rather than for perceived audio |
| 499 | // quality. |
| 500 | kNetEqFax = 2, |
roosa@google.com | b718619 | 2012-12-12 21:59:14 | [diff] [blame] | 501 | // Minimal buffer management. Inserts zeros for lost packets and during |
| 502 | // buffer increases. |
| 503 | kNetEqOff = 3, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 504 | }; |
| 505 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 506 | enum OnHoldModes // On Hold direction |
| 507 | { |
| 508 | kHoldSendAndPlay = 0, // Put both sending and playing in on-hold state. |
| 509 | kHoldSendOnly, // Put only sending in on-hold state. |
| 510 | kHoldPlayOnly // Put only playing in on-hold state. |
| 511 | }; |
| 512 | |
| 513 | enum AmrMode |
| 514 | { |
| 515 | kRfc3267BwEfficient = 0, |
| 516 | kRfc3267OctetAligned = 1, |
| 517 | kRfc3267FileStorage = 2, |
| 518 | }; |
| 519 | |
| 520 | // ================================================================== |
| 521 | // Video specific types |
| 522 | // ================================================================== |
| 523 | |
| 524 | // Raw video types |
| 525 | enum RawVideoType |
| 526 | { |
| 527 | kVideoI420 = 0, |
| 528 | kVideoYV12 = 1, |
| 529 | kVideoYUY2 = 2, |
| 530 | kVideoUYVY = 3, |
| 531 | kVideoIYUV = 4, |
| 532 | kVideoARGB = 5, |
| 533 | kVideoRGB24 = 6, |
| 534 | kVideoRGB565 = 7, |
| 535 | kVideoARGB4444 = 8, |
| 536 | kVideoARGB1555 = 9, |
| 537 | kVideoMJPEG = 10, |
| 538 | kVideoNV12 = 11, |
| 539 | kVideoNV21 = 12, |
mikhal@webrtc.org | c00f91d | 2012-01-03 18:49:15 | [diff] [blame] | 540 | kVideoBGRA = 13, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 541 | kVideoUnknown = 99 |
| 542 | }; |
| 543 | |
| 544 | // Video codec |
| 545 | enum { kConfigParameterSize = 128}; |
| 546 | enum { kPayloadNameSize = 32}; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 547 | enum { kMaxSimulcastStreams = 4}; |
pwestin@webrtc.org | db221d2 | 2011-12-02 11:31:08 | [diff] [blame] | 548 | enum { kMaxTemporalStreams = 4}; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 549 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 550 | enum VideoCodecComplexity |
| 551 | { |
| 552 | kComplexityNormal = 0, |
| 553 | kComplexityHigh = 1, |
| 554 | kComplexityHigher = 2, |
| 555 | kComplexityMax = 3 |
| 556 | }; |
| 557 | |
| 558 | enum VideoCodecProfile |
| 559 | { |
| 560 | kProfileBase = 0x00, |
| 561 | kProfileMain = 0x01 |
| 562 | }; |
| 563 | |
stefan@webrtc.org | efd0a48 | 2011-12-29 10:12:35 | [diff] [blame] | 564 | enum VP8ResilienceMode { |
| 565 | kResilienceOff, // The stream produced by the encoder requires a |
| 566 | // recovery frame (typically a key frame) to be |
| 567 | // decodable after a packet loss. |
| 568 | kResilientStream, // A stream produced by the encoder is resilient to |
| 569 | // packet losses, but packets within a frame subsequent |
| 570 | // to a loss can't be decoded. |
| 571 | kResilientFrames // Same as kResilientStream but with added resilience |
| 572 | // within a frame. |
| 573 | }; |
| 574 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 575 | // VP8 specific |
| 576 | struct VideoCodecVP8 |
| 577 | { |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 578 | bool pictureLossIndicationOn; |
| 579 | bool feedbackModeOn; |
| 580 | VideoCodecComplexity complexity; |
stefan@webrtc.org | efd0a48 | 2011-12-29 10:12:35 | [diff] [blame] | 581 | VP8ResilienceMode resilience; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 582 | unsigned char numberOfTemporalLayers; |
stefan@webrtc.org | c8e4886 | 2012-03-21 16:52:03 | [diff] [blame] | 583 | bool denoisingOn; |
stefan@webrtc.org | dc257b5 | 2012-05-30 11:25:00 | [diff] [blame] | 584 | bool errorConcealmentOn; |
henrike@webrtc.org | 3c28674 | 2012-08-10 02:44:30 | [diff] [blame] | 585 | bool automaticResizeOn; |
henrike@webrtc.org | 3387b88 | 2012-08-24 23:01:38 | [diff] [blame] | 586 | bool frameDroppingOn; |
mikhal@webrtc.org | e07c661 | 2013-01-31 16:37:13 | [diff] [blame] | 587 | int keyFrameInterval; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 588 | }; |
| 589 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 590 | // Unknown specific |
| 591 | struct VideoCodecGeneric |
| 592 | { |
| 593 | }; |
| 594 | |
| 595 | // Video codec types |
| 596 | enum VideoCodecType |
| 597 | { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 598 | kVideoCodecVP8, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 599 | kVideoCodecI420, |
| 600 | kVideoCodecRED, |
| 601 | kVideoCodecULPFEC, |
pbos@webrtc.org | 8911ce4 | 2013-03-18 16:39:03 | [diff] [blame] | 602 | kVideoCodecGeneric, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 603 | kVideoCodecUnknown |
| 604 | }; |
| 605 | |
| 606 | union VideoCodecUnion |
| 607 | { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 608 | VideoCodecVP8 VP8; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 609 | VideoCodecGeneric Generic; |
| 610 | }; |
| 611 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 612 | |
| 613 | // Simulcast is when the same stream is encoded multiple times with different |
| 614 | // settings such as resolution. |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 615 | struct SimulcastStream |
| 616 | { |
| 617 | unsigned short width; |
| 618 | unsigned short height; |
| 619 | unsigned char numberOfTemporalLayers; |
fischman@webrtc.org | 678cf29 | 2013-07-23 18:32:10 | [diff] [blame] | 620 | unsigned int maxBitrate; // kilobits/sec. |
| 621 | unsigned int targetBitrate; // kilobits/sec. |
| 622 | unsigned int minBitrate; // kilobits/sec. |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 623 | unsigned int qpMax; // minimum quality |
| 624 | }; |
| 625 | |
stefan@webrtc.org | eb91792 | 2013-02-18 14:40:18 | [diff] [blame] | 626 | enum VideoCodecMode { |
| 627 | kRealtimeVideo, |
| 628 | kScreensharing |
| 629 | }; |
| 630 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 631 | // Common video codec properties |
| 632 | struct VideoCodec |
| 633 | { |
| 634 | VideoCodecType codecType; |
| 635 | char plName[kPayloadNameSize]; |
| 636 | unsigned char plType; |
| 637 | |
| 638 | unsigned short width; |
| 639 | unsigned short height; |
| 640 | |
fischman@webrtc.org | 678cf29 | 2013-07-23 18:32:10 | [diff] [blame] | 641 | unsigned int startBitrate; // kilobits/sec. |
| 642 | unsigned int maxBitrate; // kilobits/sec. |
| 643 | unsigned int minBitrate; // kilobits/sec. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 644 | unsigned char maxFramerate; |
| 645 | |
| 646 | VideoCodecUnion codecSpecific; |
| 647 | |
| 648 | unsigned int qpMax; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 649 | unsigned char numberOfSimulcastStreams; |
| 650 | SimulcastStream simulcastStream[kMaxSimulcastStreams]; |
stefan@webrtc.org | eb91792 | 2013-02-18 14:40:18 | [diff] [blame] | 651 | |
| 652 | VideoCodecMode mode; |
andresp@webrtc.org | 185bae4 | 2013-05-14 08:02:25 | [diff] [blame] | 653 | |
| 654 | // When using an external encoder/decoder this allows to pass |
| 655 | // extra options without requiring webrtc to be aware of them. |
| 656 | Config* extra_options; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 657 | }; |
astor@webrtc.org | bd7aeba | 2012-06-26 10:47:04 | [diff] [blame] | 658 | |
| 659 | // Bandwidth over-use detector options. These are used to drive |
| 660 | // experimentation with bandwidth estimation parameters. |
| 661 | // See modules/remote_bitrate_estimator/overuse_detector.h |
| 662 | struct OverUseDetectorOptions { |
| 663 | OverUseDetectorOptions() |
| 664 | : initial_slope(8.0/512.0), |
| 665 | initial_offset(0), |
| 666 | initial_e(), |
| 667 | initial_process_noise(), |
| 668 | initial_avg_noise(0.0), |
stefan@webrtc.org | c58be0d | 2012-09-11 14:11:58 | [diff] [blame] | 669 | initial_var_noise(50), |
astor@webrtc.org | bd7aeba | 2012-06-26 10:47:04 | [diff] [blame] | 670 | initial_threshold(25.0) { |
| 671 | initial_e[0][0] = 100; |
| 672 | initial_e[1][1] = 1e-1; |
| 673 | initial_e[0][1] = initial_e[1][0] = 0; |
| 674 | initial_process_noise[0] = 1e-10; |
| 675 | initial_process_noise[1] = 1e-2; |
| 676 | } |
| 677 | double initial_slope; |
| 678 | double initial_offset; |
| 679 | double initial_e[2][2]; |
| 680 | double initial_process_noise[2]; |
| 681 | double initial_avg_noise; |
| 682 | double initial_var_noise; |
| 683 | double initial_threshold; |
| 684 | }; |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 685 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 686 | } // namespace webrtc |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 687 | |
| 688 | #endif // WEBRTC_COMMON_TYPES_H_ |
| 689 | |