blob: 33f872de92f04e0205a6d40c9cd2fa489a64828e [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
phoglund@webrtc.org8bfee842012-02-17 09:32:482 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:253 *
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.orgeda189b2013-09-09 17:50:1011#ifndef WEBRTC_COMMON_TYPES_H_
12#define WEBRTC_COMMON_TYPES_H_
niklase@google.com470e71d2011-07-07 08:21:2513
andrew@webrtc.orgeda189b2013-09-09 17:50:1014#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:2515
andrew@webrtc.org88b8b0d2012-08-14 00:05:5616#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.com470e71d2011-07-07 08:21:2522#ifdef WEBRTC_EXPORT
andrew@webrtc.org88b8b0d2012-08-14 00:05:5623#define WEBRTC_DLLEXPORT _declspec(dllexport)
niklase@google.com470e71d2011-07-07 08:21:2524#elif WEBRTC_DLL
andrew@webrtc.org88b8b0d2012-08-14 00:05:5625#define WEBRTC_DLLEXPORT _declspec(dllimport)
niklase@google.com470e71d2011-07-07 08:21:2526#else
andrew@webrtc.org88b8b0d2012-08-14 00:05:5627#define WEBRTC_DLLEXPORT
niklase@google.com470e71d2011-07-07 08:21:2528#endif
29
30#ifndef NULL
andrew@webrtc.org88b8b0d2012-08-14 00:05:5631#define NULL 0
niklase@google.com470e71d2011-07-07 08:21:2532#endif
33
henrika@webrtc.orgf75901f2012-01-16 08:45:4234#define RTP_PAYLOAD_NAME_SIZE 32
35
andrew@webrtc.orgeda189b2013-09-09 17:50:1036#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.com470e71d2011-07-07 08:21:2546namespace webrtc {
47
andresp@webrtc.org185bae42013-05-14 08:02:2548class Config;
49
niklase@google.com470e71d2011-07-07 08:21:2550class InStream
51{
52public:
53 virtual int Read(void *buf,int len) = 0;
54 virtual int Rewind() {return -1;}
55 virtual ~InStream() {}
56protected:
57 InStream() {}
58};
59
60class OutStream
61{
62public:
63 virtual bool Write(const void *buf,int len) = 0;
64 virtual int Rewind() {return -1;}
65 virtual ~OutStream() {}
66protected:
67 OutStream() {}
68};
69
70enum TraceModule
71{
andrew@webrtc.org50419b02012-11-14 19:07:5472 kTraceUndefined = 0,
niklase@google.com470e71d2011-07-07 08:21:2573 // 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
95enum 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.org655d8f52012-11-20 07:34:45114 // Non-verbose level used by LS_INFO of logging.h. Do not use directly.
115 kTraceTerseInfo = 0x2000,
116
niklase@google.com470e71d2011-07-07 08:21:25117 kTraceAll = 0xffff
118};
119
120// External Trace API
andrew@webrtc.org23ec30b2012-11-15 05:33:25121class TraceCallback {
122 public:
123 virtual void Print(TraceLevel level, const char* message, int length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25124
andrew@webrtc.org23ec30b2012-11-15 05:33:25125 protected:
126 virtual ~TraceCallback() {}
127 TraceCallback() {}
128};
niklase@google.com470e71d2011-07-07 08:21:25129
130enum 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
142enum ProcessingTypes
143{
144 kPlaybackPerChannel = 0,
145 kPlaybackAllChannelsMixed,
146 kRecordingPerChannel,
andrew@webrtc.org21ab3ba2012-10-19 17:30:56147 kRecordingAllChannelsMixed,
148 kRecordingPreprocessing
niklase@google.com470e71d2011-07-07 08:21:25149};
150
phoglund@webrtc.org8bfee842012-02-17 09:32:48151// 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.com470e71d2011-07-07 08:21:25154class Encryption
155{
156public:
phoglund@webrtc.org8bfee842012-02-17 09:32:48157 // 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.com470e71d2011-07-07 08:21:25168 virtual void encrypt(
phoglund@webrtc.org8bfee842012-02-17 09:32:48169 int channel,
niklase@google.com470e71d2011-07-07 08:21:25170 unsigned char* in_data,
171 unsigned char* out_data,
172 int bytes_in,
173 int* bytes_out) = 0;
174
phoglund@webrtc.org8bfee842012-02-17 09:32:48175 // 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.com470e71d2011-07-07 08:21:25186 virtual void decrypt(
phoglund@webrtc.org8bfee842012-02-17 09:32:48187 int channel,
niklase@google.com470e71d2011-07-07 08:21:25188 unsigned char* in_data,
189 unsigned char* out_data,
190 int bytes_in,
191 int* bytes_out) = 0;
192
phoglund@webrtc.org8bfee842012-02-17 09:32:48193 // Encrypts a RTCP packet. Otherwise, this method has the same contract as
194 // encrypt().
niklase@google.com470e71d2011-07-07 08:21:25195 virtual void encrypt_rtcp(
phoglund@webrtc.org8bfee842012-02-17 09:32:48196 int channel,
niklase@google.com470e71d2011-07-07 08:21:25197 unsigned char* in_data,
198 unsigned char* out_data,
199 int bytes_in,
200 int* bytes_out) = 0;
201
phoglund@webrtc.org8bfee842012-02-17 09:32:48202 // Decrypts a RTCP packet. Otherwise, this method has the same contract as
203 // decrypt().
niklase@google.com470e71d2011-07-07 08:21:25204 virtual void decrypt_rtcp(
phoglund@webrtc.org8bfee842012-02-17 09:32:48205 int channel,
niklase@google.com470e71d2011-07-07 08:21:25206 unsigned char* in_data,
207 unsigned char* out_data,
208 int bytes_in,
209 int* bytes_out) = 0;
210
211protected:
212 virtual ~Encryption() {}
213 Encryption() {}
214};
215
216// External transport callback interface
217class Transport
218{
219public:
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
223protected:
224 virtual ~Transport() {}
225 Transport() {}
226};
227
sprang@webrtc.orgdc50aae2013-11-20 16:47:07228// Statistics for an RTCP channel
sprang@webrtc.orgfe5d36b2013-10-28 09:21:07229struct 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.orgdc50aae2013-11-20 16:47:07245// Callback, called whenever a new rtcp report block is transmitted.
246class 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
255struct 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.
272class 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
281struct 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.
294class 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
302class 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.com470e71d2011-07-07 08:21:25310// ==================================================================
311// Voice specific types
312// ==================================================================
313
314// Each codec supported can be described by this structure.
315struct CodecInst
316{
317 int pltype;
henrika@webrtc.orgf75901f2012-01-16 08:45:42318 char plname[RTP_PAYLOAD_NAME_SIZE];
niklase@google.com470e71d2011-07-07 08:21:25319 int plfreq;
320 int pacsize;
321 int channels;
fischman@webrtc.org678cf292013-07-23 18:32:10322 int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file!
niklase@google.com470e71d2011-07-07 08:21:25323};
324
325enum 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
337enum {kRtpCsrcSize = 15}; // RFC 3550 page 13
338
339enum RTPDirections
340{
341 kRtpIncoming = 0,
342 kRtpOutgoing
343};
344
345enum PayloadFrequencies
346{
347 kFreq8000Hz = 8000,
348 kFreq16000Hz = 16000,
349 kFreq32000Hz = 32000
350};
351
352enum VadModes // degree of bandwidth reduction
353{
354 kVadConventional = 0, // lowest reduction
355 kVadAggressiveLow,
356 kVadAggressiveMid,
357 kVadAggressiveHigh // highest reduction
358};
359
360struct NetworkStatistics // NETEQ statistics
361{
362 // current jitter buffer size in ms
pbos@webrtc.org77f6b212013-05-03 12:02:11363 uint16_t currentBufferSize;
niklase@google.com470e71d2011-07-07 08:21:25364 // preferred (optimal) buffer size in ms
pbos@webrtc.org77f6b212013-05-03 12:02:11365 uint16_t preferredBufferSize;
henrik.lundin@webrtc.orgd4398702012-01-04 13:09:55366 // adding extra delay due to "peaky jitter"
367 bool jitterPeaksFound;
niklase@google.com470e71d2011-07-07 08:21:25368 // loss rate (network + late) in percent (in Q14)
pbos@webrtc.org77f6b212013-05-03 12:02:11369 uint16_t currentPacketLossRate;
niklase@google.com470e71d2011-07-07 08:21:25370 // late loss rate in percent (in Q14)
pbos@webrtc.org77f6b212013-05-03 12:02:11371 uint16_t currentDiscardRate;
niklase@google.com470e71d2011-07-07 08:21:25372 // fraction (of original stream) of synthesized speech inserted through
373 // expansion (in Q14)
pbos@webrtc.org77f6b212013-05-03 12:02:11374 uint16_t currentExpandRate;
niklase@google.com470e71d2011-07-07 08:21:25375 // fraction of synthesized speech inserted through pre-emptive expansion
376 // (in Q14)
pbos@webrtc.org77f6b212013-05-03 12:02:11377 uint16_t currentPreemptiveRate;
niklase@google.com470e71d2011-07-07 08:21:25378 // fraction of data removed through acceleration (in Q14)
pbos@webrtc.org77f6b212013-05-03 12:02:11379 uint16_t currentAccelerateRate;
henrik.lundin@webrtc.orgd4398702012-01-04 13:09:55380 // clock-drift in parts-per-million (negative or positive)
381 int32_t clockDriftPPM;
henrik.lundin@webrtc.orgdbba1f92011-12-20 15:45:05382 // 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.org053c7992012-01-12 14:16:44386 // min packet waiting time in the jitter buffer (ms)
387 int minWaitingTimeMs;
henrik.lundin@webrtc.orgdbba1f92011-12-20 15:45:05388 // max packet waiting time in the jitter buffer (ms)
389 int maxWaitingTimeMs;
roosa@google.comb8ba4d82012-12-14 00:06:18390 // added samples in off mode due to packet loss
391 int addedSamples;
niklase@google.com470e71d2011-07-07 08:21:25392};
393
niklase@google.com470e71d2011-07-07 08:21:25394typedef struct
395{
396 int min; // minumum
397 int max; // maximum
398 int average; // average
399} StatVal;
400
401typedef 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
409typedef 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.com470e71d2011-07-07 08:21:25418enum 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
429enum 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.org80124742012-03-08 17:54:24439 // can be used on embedded devices where the capture signal level
niklase@google.com470e71d2011-07-07 08:21:25440 // is predictable
441 kAgcFixedDigital
442};
443
444// EC modes
445enum 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
455enum 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
466typedef struct
467{
468 unsigned short targetLeveldBOv;
469 unsigned short digitalCompressionGaindB;
470 bool limiterEnable;
471} AgcConfig; // AGC configuration parameters
472
473enum StereoChannel
474{
475 kStereoLeft = 0,
476 kStereoRight,
477 kStereoBoth
478};
479
480// Audio device layers
481enum AudioLayers
482{
483 kAudioPlatformDefault = 0,
484 kAudioWindowsWave = 1,
485 kAudioWindowsCore = 2,
486 kAudioLinuxAlsa = 3,
487 kAudioLinuxPulse = 4
488};
489
490enum 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.comb7186192012-12-12 21:59:14501 // Minimal buffer management. Inserts zeros for lost packets and during
502 // buffer increases.
503 kNetEqOff = 3,
niklase@google.com470e71d2011-07-07 08:21:25504};
505
niklase@google.com470e71d2011-07-07 08:21:25506enum 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
513enum AmrMode
514{
515 kRfc3267BwEfficient = 0,
516 kRfc3267OctetAligned = 1,
517 kRfc3267FileStorage = 2,
518};
519
520// ==================================================================
521// Video specific types
522// ==================================================================
523
524// Raw video types
525enum 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.orgc00f91d2012-01-03 18:49:15540 kVideoBGRA = 13,
niklase@google.com470e71d2011-07-07 08:21:25541 kVideoUnknown = 99
542};
543
544// Video codec
545enum { kConfigParameterSize = 128};
546enum { kPayloadNameSize = 32};
pwestin@webrtc.org1da1ce02011-10-13 15:19:55547enum { kMaxSimulcastStreams = 4};
pwestin@webrtc.orgdb221d22011-12-02 11:31:08548enum { kMaxTemporalStreams = 4};
niklase@google.com470e71d2011-07-07 08:21:25549
niklase@google.com470e71d2011-07-07 08:21:25550enum VideoCodecComplexity
551{
552 kComplexityNormal = 0,
553 kComplexityHigh = 1,
554 kComplexityHigher = 2,
555 kComplexityMax = 3
556};
557
558enum VideoCodecProfile
559{
560 kProfileBase = 0x00,
561 kProfileMain = 0x01
562};
563
stefan@webrtc.orgefd0a482011-12-29 10:12:35564enum 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.com470e71d2011-07-07 08:21:25575// VP8 specific
576struct VideoCodecVP8
577{
pwestin@webrtc.org1da1ce02011-10-13 15:19:55578 bool pictureLossIndicationOn;
579 bool feedbackModeOn;
580 VideoCodecComplexity complexity;
stefan@webrtc.orgefd0a482011-12-29 10:12:35581 VP8ResilienceMode resilience;
pwestin@webrtc.org1da1ce02011-10-13 15:19:55582 unsigned char numberOfTemporalLayers;
stefan@webrtc.orgc8e48862012-03-21 16:52:03583 bool denoisingOn;
stefan@webrtc.orgdc257b52012-05-30 11:25:00584 bool errorConcealmentOn;
henrike@webrtc.org3c286742012-08-10 02:44:30585 bool automaticResizeOn;
henrike@webrtc.org3387b882012-08-24 23:01:38586 bool frameDroppingOn;
mikhal@webrtc.orge07c6612013-01-31 16:37:13587 int keyFrameInterval;
niklase@google.com470e71d2011-07-07 08:21:25588};
589
niklase@google.com470e71d2011-07-07 08:21:25590// Unknown specific
591struct VideoCodecGeneric
592{
593};
594
595// Video codec types
596enum VideoCodecType
597{
niklase@google.com470e71d2011-07-07 08:21:25598 kVideoCodecVP8,
niklase@google.com470e71d2011-07-07 08:21:25599 kVideoCodecI420,
600 kVideoCodecRED,
601 kVideoCodecULPFEC,
pbos@webrtc.org8911ce42013-03-18 16:39:03602 kVideoCodecGeneric,
niklase@google.com470e71d2011-07-07 08:21:25603 kVideoCodecUnknown
604};
605
606union VideoCodecUnion
607{
niklase@google.com470e71d2011-07-07 08:21:25608 VideoCodecVP8 VP8;
niklase@google.com470e71d2011-07-07 08:21:25609 VideoCodecGeneric Generic;
610};
611
phoglund@webrtc.org8bfee842012-02-17 09:32:48612
613// Simulcast is when the same stream is encoded multiple times with different
614// settings such as resolution.
pwestin@webrtc.org1da1ce02011-10-13 15:19:55615struct SimulcastStream
616{
617 unsigned short width;
618 unsigned short height;
619 unsigned char numberOfTemporalLayers;
fischman@webrtc.org678cf292013-07-23 18:32:10620 unsigned int maxBitrate; // kilobits/sec.
621 unsigned int targetBitrate; // kilobits/sec.
622 unsigned int minBitrate; // kilobits/sec.
pwestin@webrtc.org1da1ce02011-10-13 15:19:55623 unsigned int qpMax; // minimum quality
624};
625
stefan@webrtc.orgeb917922013-02-18 14:40:18626enum VideoCodecMode {
627 kRealtimeVideo,
628 kScreensharing
629};
630
niklase@google.com470e71d2011-07-07 08:21:25631// Common video codec properties
632struct 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.org678cf292013-07-23 18:32:10641 unsigned int startBitrate; // kilobits/sec.
642 unsigned int maxBitrate; // kilobits/sec.
643 unsigned int minBitrate; // kilobits/sec.
niklase@google.com470e71d2011-07-07 08:21:25644 unsigned char maxFramerate;
645
646 VideoCodecUnion codecSpecific;
647
648 unsigned int qpMax;
pwestin@webrtc.org1da1ce02011-10-13 15:19:55649 unsigned char numberOfSimulcastStreams;
650 SimulcastStream simulcastStream[kMaxSimulcastStreams];
stefan@webrtc.orgeb917922013-02-18 14:40:18651
652 VideoCodecMode mode;
andresp@webrtc.org185bae42013-05-14 08:02:25653
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.com470e71d2011-07-07 08:21:25657};
astor@webrtc.orgbd7aeba2012-06-26 10:47:04658
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
662struct 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.orgc58be0d2012-09-11 14:11:58669 initial_var_noise(50),
astor@webrtc.orgbd7aeba2012-06-26 10:47:04670 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.orgeda189b2013-09-09 17:50:10685
niklase@google.com470e71d2011-07-07 08:21:25686} // namespace webrtc
andrew@webrtc.orgeda189b2013-09-09 17:50:10687
688#endif // WEBRTC_COMMON_TYPES_H_
689