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