blob: daaf1ff9732c9ce414eec621c0993795f2cea309 [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
pbos@webrtc.orgf577ae92014-03-19 08:43:5714#include <stddef.h>
mallinath@webrtc.org0209e562014-03-21 00:41:2815#include <string.h>
kwiberg5bf4e082016-12-19 14:04:0416#include <ostream>
pbos@webrtc.org1e92b0a2014-05-15 09:35:0617#include <string>
pbos@webrtc.orgf577ae92014-03-19 08:43:5718#include <vector>
19
ilnik00d802b2017-04-11 17:34:3120#include "webrtc/api/video/video_content_type.h"
nisseaf916892017-01-10 15:44:2621#include "webrtc/api/video/video_rotation.h"
ilnik04f4d122017-06-19 14:18:5522#include "webrtc/api/video/video_timing.h"
Edward Lemurc20978e2017-07-06 17:44:3423#include "webrtc/rtc_base/array_view.h"
24#include "webrtc/rtc_base/checks.h"
srte186d9c32017-08-04 12:03:5325#include "webrtc/rtc_base/deprecation.h"
Edward Lemurc20978e2017-07-06 17:44:3426#include "webrtc/rtc_base/optional.h"
andrew@webrtc.orgeda189b2013-09-09 17:50:1027#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:2528
andrew@webrtc.org88b8b0d2012-08-14 00:05:5629#if defined(_MSC_VER)
30// Disable "new behavior: elements of array will be default initialized"
31// warning. Affects OverUseDetectorOptions.
solenberg634b86e2016-09-01 14:54:5332#pragma warning(disable : 4351)
andrew@webrtc.org88b8b0d2012-08-14 00:05:5633#endif
34
kwiberg77eab702016-09-29 00:42:0135#if defined(WEBRTC_EXPORT)
andrew@webrtc.org88b8b0d2012-08-14 00:05:5636#define WEBRTC_DLLEXPORT _declspec(dllexport)
kwiberg77eab702016-09-29 00:42:0137#elif defined(WEBRTC_DLL)
andrew@webrtc.org88b8b0d2012-08-14 00:05:5638#define WEBRTC_DLLEXPORT _declspec(dllimport)
niklase@google.com470e71d2011-07-07 08:21:2539#else
andrew@webrtc.org88b8b0d2012-08-14 00:05:5640#define WEBRTC_DLLEXPORT
niklase@google.com470e71d2011-07-07 08:21:2541#endif
42
43#ifndef NULL
andrew@webrtc.org88b8b0d2012-08-14 00:05:5644#define NULL 0
niklase@google.com470e71d2011-07-07 08:21:2545#endif
46
Peter Boström8b79b072016-02-26 15:31:3747#define RTP_PAYLOAD_NAME_SIZE 32u
henrika@webrtc.orgf75901f2012-01-16 08:45:4248
mallinath@webrtc.org0209e562014-03-21 00:41:2849#if defined(WEBRTC_WIN) || defined(WIN32)
andrew@webrtc.orgeda189b2013-09-09 17:50:1050// Compares two strings without regard to case.
51#define STR_CASE_CMP(s1, s2) ::_stricmp(s1, s2)
52// Compares characters of two strings without regard to case.
53#define STR_NCASE_CMP(s1, s2, n) ::_strnicmp(s1, s2, n)
54#else
55#define STR_CASE_CMP(s1, s2) ::strcasecmp(s1, s2)
56#define STR_NCASE_CMP(s1, s2, n) ::strncasecmp(s1, s2, n)
57#endif
58
niklase@google.com470e71d2011-07-07 08:21:2559namespace webrtc {
60
tommia6219cc2016-06-15 17:30:1461class RewindableStream {
62 public:
63 virtual ~RewindableStream() {}
64 virtual int Rewind() = 0;
niklase@google.com470e71d2011-07-07 08:21:2565};
66
tommia6219cc2016-06-15 17:30:1467class InStream : public RewindableStream {
68 public:
69 // Reads |len| bytes from file to |buf|. Returns the number of bytes read
70 // or -1 on error.
71 virtual int Read(void* buf, size_t len) = 0;
72};
73
74class OutStream : public RewindableStream {
75 public:
76 // Writes |len| bytes from |buf| to file. The actual writing may happen
77 // some time later. Call Flush() to force a write.
78 virtual bool Write(const void* buf, size_t len) = 0;
niklase@google.com470e71d2011-07-07 08:21:2579};
80
solenberg634b86e2016-09-01 14:54:5381enum TraceModule {
82 kTraceUndefined = 0,
83 // not a module, triggered from the engine code
84 kTraceVoice = 0x0001,
85 // not a module, triggered from the engine code
86 kTraceVideo = 0x0002,
87 // not a module, triggered from the utility code
88 kTraceUtility = 0x0003,
89 kTraceRtpRtcp = 0x0004,
90 kTraceTransport = 0x0005,
91 kTraceSrtp = 0x0006,
92 kTraceAudioCoding = 0x0007,
93 kTraceAudioMixerServer = 0x0008,
94 kTraceAudioMixerClient = 0x0009,
95 kTraceFile = 0x000a,
96 kTraceAudioProcessing = 0x000b,
97 kTraceVideoCoding = 0x0010,
98 kTraceVideoMixer = 0x0011,
99 kTraceAudioDevice = 0x0012,
100 kTraceVideoRenderer = 0x0014,
101 kTraceVideoCapture = 0x0015,
102 kTraceRemoteBitrateEstimator = 0x0017,
niklase@google.com470e71d2011-07-07 08:21:25103};
104
solenberg634b86e2016-09-01 14:54:53105enum TraceLevel {
106 kTraceNone = 0x0000, // no trace
107 kTraceStateInfo = 0x0001,
108 kTraceWarning = 0x0002,
109 kTraceError = 0x0004,
110 kTraceCritical = 0x0008,
111 kTraceApiCall = 0x0010,
112 kTraceDefault = 0x00ff,
niklase@google.com470e71d2011-07-07 08:21:25113
solenberg634b86e2016-09-01 14:54:53114 kTraceModuleCall = 0x0020,
115 kTraceMemory = 0x0100, // memory info
116 kTraceTimer = 0x0200, // timing info
117 kTraceStream = 0x0400, // "continuous" stream of data
niklase@google.com470e71d2011-07-07 08:21:25118
solenberg634b86e2016-09-01 14:54:53119 // used for debug purposes
120 kTraceDebug = 0x0800, // debug
121 kTraceInfo = 0x1000, // debug info
niklase@google.com470e71d2011-07-07 08:21:25122
solenberg634b86e2016-09-01 14:54:53123 // Non-verbose level used by LS_INFO of logging.h. Do not use directly.
124 kTraceTerseInfo = 0x2000,
andrew@webrtc.org655d8f52012-11-20 07:34:45125
solenberg634b86e2016-09-01 14:54:53126 kTraceAll = 0xffff
niklase@google.com470e71d2011-07-07 08:21:25127};
128
129// External Trace API
andrew@webrtc.org23ec30b2012-11-15 05:33:25130class TraceCallback {
131 public:
132 virtual void Print(TraceLevel level, const char* message, int length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25133
andrew@webrtc.org23ec30b2012-11-15 05:33:25134 protected:
135 virtual ~TraceCallback() {}
136 TraceCallback() {}
137};
niklase@google.com470e71d2011-07-07 08:21:25138
solenberg634b86e2016-09-01 14:54:53139enum FileFormats {
140 kFileFormatWavFile = 1,
141 kFileFormatCompressedFile = 2,
142 kFileFormatPreencodedFile = 4,
143 kFileFormatPcm16kHzFile = 7,
144 kFileFormatPcm8kHzFile = 8,
lliuubc436ed2017-03-31 23:32:28145 kFileFormatPcm32kHzFile = 9
niklase@google.com470e71d2011-07-07 08:21:25146};
147
pbos22993e12015-10-19 09:39:06148enum FrameType {
149 kEmptyFrame = 0,
150 kAudioFrameSpeech = 1,
151 kAudioFrameCN = 2,
152 kVideoFrameKey = 3,
153 kVideoFrameDelta = 4,
sprang@webrtc.org71f055f2013-12-04 15:09:27154};
155
sprang@webrtc.orgdc50aae2013-11-20 16:47:07156// Statistics for an RTCP channel
sprang@webrtc.orgfe5d36b2013-10-28 09:21:07157struct RtcpStatistics {
sprang@webrtc.orgfe5d36b2013-10-28 09:21:07158 RtcpStatistics()
solenberg634b86e2016-09-01 14:54:53159 : fraction_lost(0),
srte186d9c32017-08-04 12:03:53160 packets_lost(0),
161 extended_highest_sequence_number(0),
solenberg634b86e2016-09-01 14:54:53162 jitter(0) {}
sprang@webrtc.orgfe5d36b2013-10-28 09:21:07163
164 uint8_t fraction_lost;
srte186d9c32017-08-04 12:03:53165 union {
166 uint32_t packets_lost;
167 RTC_DEPRECATED uint32_t cumulative_lost;
168 };
169 union {
170 uint32_t extended_highest_sequence_number;
171 RTC_DEPRECATED uint32_t extended_max_sequence_number;
172 };
sprang@webrtc.orgfe5d36b2013-10-28 09:21:07173 uint32_t jitter;
sprang@webrtc.orgfe5d36b2013-10-28 09:21:07174};
175
sprang@webrtc.orgdc50aae2013-11-20 16:47:07176class RtcpStatisticsCallback {
177 public:
178 virtual ~RtcpStatisticsCallback() {}
179
180 virtual void StatisticsUpdated(const RtcpStatistics& statistics,
181 uint32_t ssrc) = 0;
pbos@webrtc.orgce4e9a32014-12-18 13:50:16182 virtual void CNameChanged(const char* cname, uint32_t ssrc) = 0;
sprang@webrtc.orgdc50aae2013-11-20 16:47:07183};
184
asapersson@webrtc.org8098e072014-02-19 11:59:02185// Statistics for RTCP packet types.
186struct RtcpPacketTypeCounter {
187 RtcpPacketTypeCounter()
solenberg634b86e2016-09-01 14:54:53188 : first_packet_time_ms(-1),
189 nack_packets(0),
190 fir_packets(0),
191 pli_packets(0),
192 nack_requests(0),
193 unique_nack_requests(0) {}
asapersson@webrtc.org8098e072014-02-19 11:59:02194
195 void Add(const RtcpPacketTypeCounter& other) {
196 nack_packets += other.nack_packets;
197 fir_packets += other.fir_packets;
198 pli_packets += other.pli_packets;
asapersson@webrtc.org2dd31342014-10-29 12:42:30199 nack_requests += other.nack_requests;
200 unique_nack_requests += other.unique_nack_requests;
asapersson@webrtc.orgd08d3892014-12-16 12:03:11201 if (other.first_packet_time_ms != -1 &&
solenberg634b86e2016-09-01 14:54:53202 (other.first_packet_time_ms < first_packet_time_ms ||
203 first_packet_time_ms == -1)) {
asapersson@webrtc.orgd08d3892014-12-16 12:03:11204 // Use oldest time.
205 first_packet_time_ms = other.first_packet_time_ms;
206 }
207 }
208
sprang07fb9be2016-02-24 15:55:00209 void Subtract(const RtcpPacketTypeCounter& other) {
210 nack_packets -= other.nack_packets;
211 fir_packets -= other.fir_packets;
212 pli_packets -= other.pli_packets;
213 nack_requests -= other.nack_requests;
214 unique_nack_requests -= other.unique_nack_requests;
215 if (other.first_packet_time_ms != -1 &&
216 (other.first_packet_time_ms > first_packet_time_ms ||
217 first_packet_time_ms == -1)) {
218 // Use youngest time.
219 first_packet_time_ms = other.first_packet_time_ms;
220 }
221 }
222
asapersson@webrtc.orgd08d3892014-12-16 12:03:11223 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
224 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
asapersson@webrtc.org8098e072014-02-19 11:59:02225 }
226
asapersson@webrtc.org2dd31342014-10-29 12:42:30227 int UniqueNackRequestsInPercent() const {
228 if (nack_requests == 0) {
229 return 0;
230 }
solenberg634b86e2016-09-01 14:54:53231 return static_cast<int>((unique_nack_requests * 100.0f / nack_requests) +
232 0.5f);
asapersson@webrtc.org2dd31342014-10-29 12:42:30233 }
234
solenberg634b86e2016-09-01 14:54:53235 int64_t first_packet_time_ms; // Time when first packet is sent/received.
236 uint32_t nack_packets; // Number of RTCP NACK packets.
237 uint32_t fir_packets; // Number of RTCP FIR packets.
238 uint32_t pli_packets; // Number of RTCP PLI packets.
239 uint32_t nack_requests; // Number of NACKed RTP packets.
asapersson@webrtc.org2dd31342014-10-29 12:42:30240 uint32_t unique_nack_requests; // Number of unique NACKed RTP packets.
asapersson@webrtc.org8098e072014-02-19 11:59:02241};
242
pbos@webrtc.org1d0fa5d2015-02-19 12:47:00243class RtcpPacketTypeCounterObserver {
244 public:
245 virtual ~RtcpPacketTypeCounterObserver() {}
246 virtual void RtcpPacketTypesCounterUpdated(
247 uint32_t ssrc,
248 const RtcpPacketTypeCounter& packet_counter) = 0;
249};
250
asapersson@webrtc.orgd08d3892014-12-16 12:03:11251// Rate statistics for a stream.
sprang@webrtc.orgdc50aae2013-11-20 16:47:07252struct BitrateStatistics {
sprangcd349d92016-07-13 16:11:28253 BitrateStatistics() : bitrate_bps(0), packet_rate(0) {}
sprang@webrtc.orgdc50aae2013-11-20 16:47:07254
solenberg634b86e2016-09-01 14:54:53255 uint32_t bitrate_bps; // Bitrate in bits per second.
256 uint32_t packet_rate; // Packet rate in packets per second.
sprang@webrtc.orgdc50aae2013-11-20 16:47:07257};
258
259// Callback, used to notify an observer whenever new rates have been estimated.
260class BitrateStatisticsObserver {
261 public:
262 virtual ~BitrateStatisticsObserver() {}
263
sprangcd349d92016-07-13 16:11:28264 virtual void Notify(uint32_t total_bitrate_bps,
265 uint32_t retransmit_bitrate_bps,
stefan@webrtc.org0bae1fa2014-11-05 14:05:29266 uint32_t ssrc) = 0;
sprang@webrtc.orgdc50aae2013-11-20 16:47:07267};
268
pbos@webrtc.orgce4e9a32014-12-18 13:50:16269struct FrameCounts {
270 FrameCounts() : key_frames(0), delta_frames(0) {}
271 int key_frames;
272 int delta_frames;
273};
274
asapersson@webrtc.orgd08d3892014-12-16 12:03:11275// Callback, used to notify an observer whenever frame counts have been updated.
sprang@webrtc.orgdc50aae2013-11-20 16:47:07276class FrameCountObserver {
277 public:
sprang@webrtc.org72964bd2013-11-21 09:09:54278 virtual ~FrameCountObserver() {}
pbos@webrtc.orgce4e9a32014-12-18 13:50:16279 virtual void FrameCountUpdated(const FrameCounts& frame_counts,
280 uint32_t ssrc) = 0;
sprang@webrtc.orgdc50aae2013-11-20 16:47:07281};
282
stefan@webrtc.org168f23f2014-07-11 13:44:02283// Callback, used to notify an observer whenever the send-side delay is updated.
284class SendSideDelayObserver {
285 public:
286 virtual ~SendSideDelayObserver() {}
287 virtual void SendSideDelayUpdated(int avg_delay_ms,
288 int max_delay_ms,
289 uint32_t ssrc) = 0;
290};
291
asapersson35151f32016-05-03 06:44:01292// Callback, used to notify an observer whenever a packet is sent to the
293// transport.
294// TODO(asapersson): This class will remove the need for SendSideDelayObserver.
295// Remove SendSideDelayObserver once possible.
296class SendPacketObserver {
297 public:
298 virtual ~SendPacketObserver() {}
299 virtual void OnSendPacket(uint16_t packet_id,
300 int64_t capture_time_ms,
301 uint32_t ssrc) = 0;
302};
303
michaelt4da30442016-11-17 09:38:43304// Callback, used to notify an observer when the overhead per packet
305// has changed.
306class OverheadObserver {
307 public:
308 virtual ~OverheadObserver() = default;
309 virtual void OnOverheadChanged(size_t overhead_bytes_per_packet) = 0;
310};
311
niklase@google.com470e71d2011-07-07 08:21:25312// ==================================================================
313// Voice specific types
314// ==================================================================
315
316// Each codec supported can be described by this structure.
mallinath@webrtc.org0209e562014-03-21 00:41:28317struct CodecInst {
318 int pltype;
319 char plname[RTP_PAYLOAD_NAME_SIZE];
320 int plfreq;
321 int pacsize;
Peter Kasting69558702016-01-13 00:26:35322 size_t channels;
mallinath@webrtc.org0209e562014-03-21 00:41:28323 int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file!
324
325 bool operator==(const CodecInst& other) const {
326 return pltype == other.pltype &&
327 (STR_CASE_CMP(plname, other.plname) == 0) &&
solenberg634b86e2016-09-01 14:54:53328 plfreq == other.plfreq && pacsize == other.pacsize &&
329 channels == other.channels && rate == other.rate;
mallinath@webrtc.org0209e562014-03-21 00:41:28330 }
331
solenberg634b86e2016-09-01 14:54:53332 bool operator!=(const CodecInst& other) const { return !(*this == other); }
kwiberg5bf4e082016-12-19 14:04:04333
334 friend std::ostream& operator<<(std::ostream& os, const CodecInst& ci) {
335 os << "{pltype: " << ci.pltype;
336 os << ", plname: " << ci.plname;
337 os << ", plfreq: " << ci.plfreq;
338 os << ", pacsize: " << ci.pacsize;
339 os << ", channels: " << ci.channels;
340 os << ", rate: " << ci.rate << "}";
341 return os;
342 }
niklase@google.com470e71d2011-07-07 08:21:25343};
344
niklase@google.com470e71d2011-07-07 08:21:25345// RTP
solenberg634b86e2016-09-01 14:54:53346enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13
niklase@google.com470e71d2011-07-07 08:21:25347
solenberg634b86e2016-09-01 14:54:53348enum PayloadFrequencies {
349 kFreq8000Hz = 8000,
350 kFreq16000Hz = 16000,
351 kFreq32000Hz = 32000
niklase@google.com470e71d2011-07-07 08:21:25352};
353
solenberg634b86e2016-09-01 14:54:53354// Degree of bandwidth reduction.
355enum VadModes {
356 kVadConventional = 0, // lowest reduction
357 kVadAggressiveLow,
358 kVadAggressiveMid,
359 kVadAggressiveHigh // highest reduction
niklase@google.com470e71d2011-07-07 08:21:25360};
361
solenberg634b86e2016-09-01 14:54:53362// NETEQ statistics.
363struct NetworkStatistics {
364 // current jitter buffer size in ms
365 uint16_t currentBufferSize;
366 // preferred (optimal) buffer size in ms
367 uint16_t preferredBufferSize;
368 // adding extra delay due to "peaky jitter"
369 bool jitterPeaksFound;
370 // Loss rate (network + late); fraction between 0 and 1, scaled to Q14.
371 uint16_t currentPacketLossRate;
372 // Late loss rate; fraction between 0 and 1, scaled to Q14.
373 uint16_t currentDiscardRate;
374 // fraction (of original stream) of synthesized audio inserted through
375 // expansion (in Q14)
376 uint16_t currentExpandRate;
377 // fraction (of original stream) of synthesized speech inserted through
378 // expansion (in Q14)
379 uint16_t currentSpeechExpandRate;
380 // fraction of synthesized speech inserted through pre-emptive expansion
381 // (in Q14)
382 uint16_t currentPreemptiveRate;
383 // fraction of data removed through acceleration (in Q14)
384 uint16_t currentAccelerateRate;
385 // fraction of data coming from secondary decoding (in Q14)
386 uint16_t currentSecondaryDecodedRate;
387 // clock-drift in parts-per-million (negative or positive)
388 int32_t clockDriftPPM;
389 // average packet waiting time in the jitter buffer (ms)
390 int meanWaitingTimeMs;
391 // median packet waiting time in the jitter buffer (ms)
392 int medianWaitingTimeMs;
393 // min packet waiting time in the jitter buffer (ms)
394 int minWaitingTimeMs;
395 // max packet waiting time in the jitter buffer (ms)
396 int maxWaitingTimeMs;
397 // added samples in off mode due to packet loss
398 size_t addedSamples;
niklase@google.com470e71d2011-07-07 08:21:25399};
400
wu@webrtc.org24301a62013-12-13 19:17:43401// Statistics for calls to AudioCodingModule::PlayoutData10Ms().
402struct AudioDecodingCallStats {
403 AudioDecodingCallStats()
404 : calls_to_silence_generator(0),
405 calls_to_neteq(0),
406 decoded_normal(0),
407 decoded_plc(0),
408 decoded_cng(0),
henrik.lundin63489782016-09-20 08:47:12409 decoded_plc_cng(0),
410 decoded_muted_output(0) {}
wu@webrtc.org24301a62013-12-13 19:17:43411
412 int calls_to_silence_generator; // Number of calls where silence generated,
413 // and NetEq was disengaged from decoding.
solenberg634b86e2016-09-01 14:54:53414 int calls_to_neteq; // Number of calls to NetEq.
wu@webrtc.org24301a62013-12-13 19:17:43415 int decoded_normal; // Number of calls where audio RTP packet decoded.
solenberg634b86e2016-09-01 14:54:53416 int decoded_plc; // Number of calls resulted in PLC.
wu@webrtc.org24301a62013-12-13 19:17:43417 int decoded_cng; // Number of calls where comfort noise generated due to DTX.
418 int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG.
henrik.lundin63489782016-09-20 08:47:12419 int decoded_muted_output; // Number of calls returning a muted state output.
wu@webrtc.org24301a62013-12-13 19:17:43420};
421
niklase@google.com470e71d2011-07-07 08:21:25422// ==================================================================
423// Video specific types
424// ==================================================================
425
nisseeb44b392017-04-28 14:18:05426// TODO(nisse): Delete, and switch to fourcc values everywhere?
427// Supported video types.
428enum class VideoType {
429 kUnknown,
430 kI420,
431 kIYUV,
432 kRGB24,
433 kABGR,
434 kARGB,
435 kARGB4444,
436 kRGB565,
437 kARGB1555,
438 kYUY2,
439 kYV12,
440 kUYVY,
441 kMJPEG,
442 kNV21,
443 kNV12,
444 kBGRA,
niklase@google.com470e71d2011-07-07 08:21:25445};
446
447// Video codec
solenberg634b86e2016-09-01 14:54:53448enum { kPayloadNameSize = 32 };
449enum { kMaxSimulcastStreams = 4 };
sprangce4aef12015-11-02 15:23:20450enum { kMaxSpatialLayers = 5 };
solenberg634b86e2016-09-01 14:54:53451enum { kMaxTemporalStreams = 4 };
niklase@google.com470e71d2011-07-07 08:21:25452
solenberg634b86e2016-09-01 14:54:53453enum VideoCodecComplexity {
454 kComplexityNormal = 0,
455 kComplexityHigh = 1,
456 kComplexityHigher = 2,
457 kComplexityMax = 3
niklase@google.com470e71d2011-07-07 08:21:25458};
459
stefan@webrtc.orgefd0a482011-12-29 10:12:35460enum VP8ResilienceMode {
461 kResilienceOff, // The stream produced by the encoder requires a
462 // recovery frame (typically a key frame) to be
463 // decodable after a packet loss.
464 kResilientStream, // A stream produced by the encoder is resilient to
465 // packet losses, but packets within a frame subsequent
466 // to a loss can't be decoded.
467 kResilientFrames // Same as kResilientStream but with added resilience
468 // within a frame.
469};
470
Peter Boström7b971e72016-01-19 15:26:16471class TemporalLayersFactory;
niklase@google.com470e71d2011-07-07 08:21:25472// VP8 specific
mallinath@webrtc.org0209e562014-03-21 00:41:28473struct VideoCodecVP8 {
nisse3257b162017-03-21 08:54:13474 // TODO(nisse): Unused, delete?
solenberg634b86e2016-09-01 14:54:53475 bool pictureLossIndicationOn;
mallinath@webrtc.org0209e562014-03-21 00:41:28476 VideoCodecComplexity complexity;
solenberg634b86e2016-09-01 14:54:53477 VP8ResilienceMode resilience;
478 unsigned char numberOfTemporalLayers;
479 bool denoisingOn;
480 bool errorConcealmentOn;
481 bool automaticResizeOn;
482 bool frameDroppingOn;
483 int keyFrameInterval;
Erik Språng08127a92016-11-16 15:41:30484 TemporalLayersFactory* tl_factory;
niklase@google.com470e71d2011-07-07 08:21:25485};
486
asaperssona9455ab2015-07-31 13:10:09487// VP9 specific.
marpan@webrtc.org5b883172014-11-01 06:10:48488struct VideoCodecVP9 {
489 VideoCodecComplexity complexity;
asapersson15dcb382017-06-08 09:55:08490 bool resilienceOn;
solenberg634b86e2016-09-01 14:54:53491 unsigned char numberOfTemporalLayers;
492 bool denoisingOn;
493 bool frameDroppingOn;
494 int keyFrameInterval;
495 bool adaptiveQpMode;
496 bool automaticResizeOn;
497 unsigned char numberOfSpatialLayers;
498 bool flexibleMode;
marpan@webrtc.org5b883172014-11-01 06:10:48499};
500
magjede69a1a92016-11-25 18:06:31501// TODO(magjed): Move this and other H264 related classes out to their own file.
502namespace H264 {
503
504enum Profile {
505 kProfileConstrainedBaseline,
506 kProfileBaseline,
507 kProfileMain,
508 kProfileConstrainedHigh,
509 kProfileHigh,
510};
511
512} // namespace H264
513
stefan@webrtc.orgb9f54532014-07-04 12:42:07514// H264 specific.
marpan@webrtc.org5b883172014-11-01 06:10:48515struct VideoCodecH264 {
solenberg634b86e2016-09-01 14:54:53516 bool frameDroppingOn;
517 int keyFrameInterval;
marpan@webrtc.org5b883172014-11-01 06:10:48518 // These are NULL/0 if not externally negotiated.
519 const uint8_t* spsData;
solenberg634b86e2016-09-01 14:54:53520 size_t spsLen;
marpan@webrtc.org5b883172014-11-01 06:10:48521 const uint8_t* ppsData;
solenberg634b86e2016-09-01 14:54:53522 size_t ppsLen;
magjede69a1a92016-11-25 18:06:31523 H264::Profile profile;
stefan@webrtc.orgb9f54532014-07-04 12:42:07524};
525
niklase@google.com470e71d2011-07-07 08:21:25526// Video codec types
marpan@webrtc.org5b883172014-11-01 06:10:48527enum VideoCodecType {
528 kVideoCodecVP8,
529 kVideoCodecVP9,
530 kVideoCodecH264,
531 kVideoCodecI420,
532 kVideoCodecRED,
533 kVideoCodecULPFEC,
brandtr87d7d772016-11-07 11:03:41534 kVideoCodecFlexfec,
marpan@webrtc.org5b883172014-11-01 06:10:48535 kVideoCodecGeneric,
536 kVideoCodecUnknown
niklase@google.com470e71d2011-07-07 08:21:25537};
538
Erik Språng08127a92016-11-16 15:41:30539// Translates from name of codec to codec type and vice versa.
magjed10165ab2016-11-22 18:16:57540rtc::Optional<const char*> CodecTypeToPayloadName(VideoCodecType type);
Erik Språng08127a92016-11-16 15:41:30541rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name);
542
marpan@webrtc.org5b883172014-11-01 06:10:48543union VideoCodecUnion {
solenberg634b86e2016-09-01 14:54:53544 VideoCodecVP8 VP8;
545 VideoCodecVP9 VP9;
546 VideoCodecH264 H264;
niklase@google.com470e71d2011-07-07 08:21:25547};
548
phoglund@webrtc.org8bfee842012-02-17 09:32:48549// Simulcast is when the same stream is encoded multiple times with different
550// settings such as resolution.
mallinath@webrtc.org0209e562014-03-21 00:41:28551struct SimulcastStream {
solenberg634b86e2016-09-01 14:54:53552 unsigned short width;
553 unsigned short height;
554 unsigned char numberOfTemporalLayers;
555 unsigned int maxBitrate; // kilobits/sec.
556 unsigned int targetBitrate; // kilobits/sec.
557 unsigned int minBitrate; // kilobits/sec.
558 unsigned int qpMax; // minimum quality
pwestin@webrtc.org1da1ce02011-10-13 15:19:55559};
560
sprangce4aef12015-11-02 15:23:20561struct SpatialLayer {
562 int scaling_factor_num;
563 int scaling_factor_den;
564 int target_bitrate_bps;
565 // TODO(ivica): Add max_quantizer and min_quantizer?
566};
567
solenberg634b86e2016-09-01 14:54:53568enum VideoCodecMode { kRealtimeVideo, kScreensharing };
stefan@webrtc.orgeb917922013-02-18 14:40:18569
niklase@google.com470e71d2011-07-07 08:21:25570// Common video codec properties
hta257dc392016-10-25 16:05:06571class VideoCodec {
572 public:
573 VideoCodec();
574
575 // Public variables. TODO(hta): Make them private with accessors.
solenberg634b86e2016-09-01 14:54:53576 VideoCodecType codecType;
577 char plName[kPayloadNameSize];
578 unsigned char plType;
niklase@google.com470e71d2011-07-07 08:21:25579
solenberg634b86e2016-09-01 14:54:53580 unsigned short width;
581 unsigned short height;
niklase@google.com470e71d2011-07-07 08:21:25582
solenberg634b86e2016-09-01 14:54:53583 unsigned int startBitrate; // kilobits/sec.
584 unsigned int maxBitrate; // kilobits/sec.
585 unsigned int minBitrate; // kilobits/sec.
586 unsigned int targetBitrate; // kilobits/sec.
pbos@webrtc.org3c412b22014-03-24 12:36:52587
Stefan Holmer144475b2017-03-10 14:08:26588 uint32_t maxFramerate;
niklase@google.com470e71d2011-07-07 08:21:25589
solenberg634b86e2016-09-01 14:54:53590 unsigned int qpMax;
591 unsigned char numberOfSimulcastStreams;
592 SimulcastStream simulcastStream[kMaxSimulcastStreams];
sprangce4aef12015-11-02 15:23:20593 SpatialLayer spatialLayers[kMaxSpatialLayers];
stefan@webrtc.orgeb917922013-02-18 14:40:18594
solenberg634b86e2016-09-01 14:54:53595 VideoCodecMode mode;
596 bool expect_encode_from_texture;
andresp@webrtc.org185bae42013-05-14 08:02:25597
ilnik04f4d122017-06-19 14:18:55598 // Timing frames configuration. There is delay of delay_ms between two
599 // consequent timing frames, excluding outliers. Frame is always made a
600 // timing frame if it's at least outlier_ratio in percent of "ideal" average
601 // frame given bitrate and framerate, i.e. if it's bigger than
602 // |outlier_ratio / 100.0 * bitrate_bps / fps| in bits. This way, timing
603 // frames will not be sent too often usually. Yet large frames will always
604 // have timing information for debug purposes because they are more likely to
605 // cause extra delays.
606 struct TimingFrameTriggerThresholds {
607 int64_t delay_ms;
608 uint16_t outlier_ratio_percent;
609 } timing_frame_thresholds;
610
Peter Boström7b971e72016-01-19 15:26:16611 bool operator==(const VideoCodec& other) const = delete;
612 bool operator!=(const VideoCodec& other) const = delete;
hta257dc392016-10-25 16:05:06613
614 // Accessors for codec specific information.
615 // There is a const version of each that returns a reference,
616 // and a non-const version that returns a pointer, in order
617 // to allow modification of the parameters.
618 VideoCodecVP8* VP8();
619 const VideoCodecVP8& VP8() const;
620 VideoCodecVP9* VP9();
621 const VideoCodecVP9& VP9() const;
622 VideoCodecH264* H264();
623 const VideoCodecH264& H264() const;
624
hta527d3472016-11-17 07:23:04625 private:
hta257dc392016-10-25 16:05:06626 // TODO(hta): Consider replacing the union with a pointer type.
627 // This will allow removing the VideoCodec* types from this file.
hta527d3472016-11-17 07:23:04628 VideoCodecUnion codec_specific_;
niklase@google.com470e71d2011-07-07 08:21:25629};
astor@webrtc.orgbd7aeba2012-06-26 10:47:04630
Erik Språng08127a92016-11-16 15:41:30631class BitrateAllocation {
632 public:
633 static const uint32_t kMaxBitrateBps;
634 BitrateAllocation();
635
636 bool SetBitrate(size_t spatial_index,
637 size_t temporal_index,
638 uint32_t bitrate_bps);
639
640 uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const;
641
642 // Get the sum of all the temporal layer for a specific spatial layer.
643 uint32_t GetSpatialLayerSum(size_t spatial_index) const;
644
645 uint32_t get_sum_bps() const { return sum_; } // Sum of all bitrates.
646 uint32_t get_sum_kbps() const { return (sum_ + 500) / 1000; }
647
648 inline bool operator==(const BitrateAllocation& other) const {
649 return memcmp(bitrates_, other.bitrates_, sizeof(bitrates_)) == 0;
650 }
651 inline bool operator!=(const BitrateAllocation& other) const {
652 return !(*this == other);
653 }
654
sprangd0fc37a2017-06-22 12:40:25655 // Expensive, please use only in tests.
656 std::string ToString() const;
657 std::ostream& operator<<(std::ostream& os) const;
658
Erik Språng08127a92016-11-16 15:41:30659 private:
660 uint32_t sum_;
661 uint32_t bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
662};
663
stefan64c0a0a2015-11-27 09:02:31664// Bandwidth over-use detector options. These are used to drive
665// experimentation with bandwidth estimation parameters.
666// See modules/remote_bitrate_estimator/overuse_detector.h
terelius84f83f82016-12-27 18:43:01667// TODO(terelius): This is only used in overuse_estimator.cc, and only in the
668// default constructed state. Can we move the relevant variables into that
669// class and delete this? See also disabled warning at line 27
stefan64c0a0a2015-11-27 09:02:31670struct OverUseDetectorOptions {
671 OverUseDetectorOptions()
solenberg634b86e2016-09-01 14:54:53672 : initial_slope(8.0 / 512.0),
stefan64c0a0a2015-11-27 09:02:31673 initial_offset(0),
674 initial_e(),
675 initial_process_noise(),
676 initial_avg_noise(0.0),
677 initial_var_noise(50) {
678 initial_e[0][0] = 100;
679 initial_e[1][1] = 1e-1;
680 initial_e[0][1] = initial_e[1][0] = 0;
681 initial_process_noise[0] = 1e-13;
stefan1069cac2016-03-10 13:13:21682 initial_process_noise[1] = 1e-3;
stefan64c0a0a2015-11-27 09:02:31683 }
684 double initial_slope;
685 double initial_offset;
686 double initial_e[2][2];
687 double initial_process_noise[2];
688 double initial_avg_noise;
689 double initial_var_noise;
690};
691
wu@webrtc.orga9890802013-12-13 00:21:03692// This structure will have the information about when packet is actually
693// received by socket.
694struct PacketTime {
henrike@webrtc.org82d3cb62014-04-29 17:50:47695 PacketTime() : timestamp(-1), not_before(-1) {}
696 PacketTime(int64_t timestamp, int64_t not_before)
solenberg634b86e2016-09-01 14:54:53697 : timestamp(timestamp), not_before(not_before) {}
wu@webrtc.orga9890802013-12-13 00:21:03698
henrike@webrtc.org82d3cb62014-04-29 17:50:47699 int64_t timestamp; // Receive time after socket delivers the data.
700 int64_t not_before; // Earliest possible time the data could have arrived,
701 // indicating the potential error in the |timestamp|
702 // value,in case the system is busy.
703 // For example, the time of the last select() call.
704 // If unknown, this value will be set to zero.
wu@webrtc.orga9890802013-12-13 00:21:03705};
706
isheriff6b4b5f32016-06-08 07:24:21707// Minimum and maximum playout delay values from capture to render.
708// These are best effort values.
709//
710// A value < 0 indicates no change from previous valid value.
711//
712// min = max = 0 indicates that the receiver should try and render
713// frame as soon as possible.
714//
715// min = x, max = y indicates that the receiver is free to adapt
716// in the range (x, y) based on network jitter.
717//
718// Note: Given that this gets embedded in a union, it is up-to the owner to
719// initialize these values.
720struct PlayoutDelay {
721 int min_ms;
722 int max_ms;
723};
724
Steve Antona3251dd2017-07-21 16:58:31725// Class to represent the value of RTP header extensions that are
726// variable-length strings (e.g., RtpStreamId and RtpMid).
danilchapef8d7732017-04-19 09:59:48727// Unlike std::string, it can be copied with memcpy and cleared with memset.
Steve Antona3251dd2017-07-21 16:58:31728//
729// Empty value represents unset header extension (use empty() to query).
730class StringRtpHeaderExtension {
danilchapef8d7732017-04-19 09:59:48731 public:
Steve Antona3251dd2017-07-21 16:58:31732 // String RTP header extensions are limited to 16 bytes because it is the
733 // maximum length that can be encoded with one-byte header extensions.
danilchapef8d7732017-04-19 09:59:48734 static constexpr size_t kMaxSize = 16;
735
eladalond0244c22017-06-08 11:19:13736 static bool IsLegalName(rtc::ArrayView<const char> name);
737
Steve Antona3251dd2017-07-21 16:58:31738 StringRtpHeaderExtension() { value_[0] = 0; }
739 explicit StringRtpHeaderExtension(rtc::ArrayView<const char> value) {
danilchapef8d7732017-04-19 09:59:48740 Set(value.data(), value.size());
741 }
Steve Antona3251dd2017-07-21 16:58:31742 StringRtpHeaderExtension(const StringRtpHeaderExtension&) = default;
743 StringRtpHeaderExtension& operator=(const StringRtpHeaderExtension&) =
744 default;
danilchapef8d7732017-04-19 09:59:48745
746 bool empty() const { return value_[0] == 0; }
747 const char* data() const { return value_; }
748 size_t size() const { return strnlen(value_, kMaxSize); }
749
750 void Set(rtc::ArrayView<const uint8_t> value) {
751 Set(reinterpret_cast<const char*>(value.data()), value.size());
752 }
753 void Set(const char* data, size_t size);
754
Steve Antona3251dd2017-07-21 16:58:31755 friend bool operator==(const StringRtpHeaderExtension& lhs,
756 const StringRtpHeaderExtension& rhs) {
danilchapef8d7732017-04-19 09:59:48757 return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0;
758 }
Steve Antona3251dd2017-07-21 16:58:31759 friend bool operator!=(const StringRtpHeaderExtension& lhs,
760 const StringRtpHeaderExtension& rhs) {
danilchapef8d7732017-04-19 09:59:48761 return !(lhs == rhs);
762 }
763
764 private:
765 char value_[kMaxSize];
766};
767
Steve Antona3251dd2017-07-21 16:58:31768// StreamId represents RtpStreamId which is a string.
769typedef StringRtpHeaderExtension StreamId;
770
771// Mid represents RtpMid which is a string.
772typedef StringRtpHeaderExtension Mid;
773
solenberg@webrtc.orgb1f50102014-03-24 10:38:25774struct RTPHeaderExtension {
sprang@webrtc.org30933902015-03-17 14:33:12775 RTPHeaderExtension();
solenberg@webrtc.orgb1f50102014-03-24 10:38:25776
777 bool hasTransmissionTimeOffset;
778 int32_t transmissionTimeOffset;
779 bool hasAbsoluteSendTime;
780 uint32_t absoluteSendTime;
sprang@webrtc.org30933902015-03-17 14:33:12781 bool hasTransportSequenceNumber;
782 uint16_t transportSequenceNumber;
solenberg@webrtc.orgb1f50102014-03-24 10:38:25783
784 // Audio Level includes both level in dBov and voiced/unvoiced bit. See:
785 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
786 bool hasAudioLevel;
Minyue4cee4192015-08-10 13:08:36787 bool voiceActivity;
solenberg@webrtc.orgb1f50102014-03-24 10:38:25788 uint8_t audioLevel;
guoweis@webrtc.org45362892015-03-04 22:55:15789
790 // For Coordination of Video Orientation. See
791 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
792 // ts_126114v120700p.pdf
793 bool hasVideoRotation;
magjed71eb61c2016-09-08 10:24:58794 VideoRotation videoRotation;
isheriff6b4b5f32016-06-08 07:24:21795
ilnik00d802b2017-04-11 17:34:31796 // TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove
797 // a corresponding bool flag.
798 bool hasVideoContentType;
799 VideoContentType videoContentType;
800
ilnik04f4d122017-06-19 14:18:55801 bool has_video_timing;
ilnik2edc6842017-07-06 10:06:50802 VideoSendTiming video_timing;
ilnik04f4d122017-06-19 14:18:55803
isheriff6b4b5f32016-06-08 07:24:21804 PlayoutDelay playout_delay = {-1, -1};
danilchapef8d7732017-04-19 09:59:48805
806 // For identification of a stream when ssrc is not signaled. See
807 // https://tools.ietf.org/html/draft-ietf-avtext-rid-09
808 // TODO(danilchap): Update url from draft to release version.
809 StreamId stream_id;
810 StreamId repaired_stream_id;
Steve Antona3251dd2017-07-21 16:58:31811
812 // For identifying the media section used to interpret this RTP packet. See
813 // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-38
814 Mid mid;
solenberg@webrtc.orgb1f50102014-03-24 10:38:25815};
816
817struct RTPHeader {
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22818 RTPHeader();
solenberg@webrtc.orgb1f50102014-03-24 10:38:25819
820 bool markerBit;
821 uint8_t payloadType;
822 uint16_t sequenceNumber;
823 uint32_t timestamp;
824 uint32_t ssrc;
825 uint8_t numCSRCs;
826 uint32_t arrOfCSRCs[kRtpCsrcSize];
pkasting@chromium.org4591fbd2014-11-20 22:28:14827 size_t paddingLength;
828 size_t headerLength;
solenberg@webrtc.orgb1f50102014-03-24 10:38:25829 int payload_type_frequency;
830 RTPHeaderExtension extension;
831};
832
asapersson@webrtc.org44149392015-02-04 08:34:47833struct RtpPacketCounter {
834 RtpPacketCounter()
solenberg634b86e2016-09-01 14:54:53835 : header_bytes(0), payload_bytes(0), padding_bytes(0), packets(0) {}
asapersson@webrtc.org44149392015-02-04 08:34:47836
837 void Add(const RtpPacketCounter& other) {
838 header_bytes += other.header_bytes;
839 payload_bytes += other.payload_bytes;
840 padding_bytes += other.padding_bytes;
841 packets += other.packets;
842 }
843
Erik Språng22c2b482016-03-01 08:40:42844 void Subtract(const RtpPacketCounter& other) {
kwibergb890c95c2016-11-29 13:30:40845 RTC_DCHECK_GE(header_bytes, other.header_bytes);
Erik Språng22c2b482016-03-01 08:40:42846 header_bytes -= other.header_bytes;
kwibergb890c95c2016-11-29 13:30:40847 RTC_DCHECK_GE(payload_bytes, other.payload_bytes);
Erik Språng22c2b482016-03-01 08:40:42848 payload_bytes -= other.payload_bytes;
kwibergb890c95c2016-11-29 13:30:40849 RTC_DCHECK_GE(padding_bytes, other.padding_bytes);
Erik Språng22c2b482016-03-01 08:40:42850 padding_bytes -= other.padding_bytes;
kwibergb890c95c2016-11-29 13:30:40851 RTC_DCHECK_GE(packets, other.packets);
Erik Språng22c2b482016-03-01 08:40:42852 packets -= other.packets;
853 }
854
asapersson@webrtc.org44149392015-02-04 08:34:47855 void AddPacket(size_t packet_length, const RTPHeader& header) {
856 ++packets;
857 header_bytes += header.headerLength;
858 padding_bytes += header.paddingLength;
859 payload_bytes +=
860 packet_length - (header.headerLength + header.paddingLength);
861 }
862
863 size_t TotalBytes() const {
864 return header_bytes + payload_bytes + padding_bytes;
865 }
866
867 size_t header_bytes; // Number of bytes used by RTP headers.
868 size_t payload_bytes; // Payload bytes, excluding RTP headers and padding.
869 size_t padding_bytes; // Number of padding bytes.
870 uint32_t packets; // Number of packets.
871};
872
873// Data usage statistics for a (rtp) stream.
874struct StreamDataCounters {
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22875 StreamDataCounters();
asapersson@webrtc.org44149392015-02-04 08:34:47876
877 void Add(const StreamDataCounters& other) {
878 transmitted.Add(other.transmitted);
879 retransmitted.Add(other.retransmitted);
880 fec.Add(other.fec);
881 if (other.first_packet_time_ms != -1 &&
solenberg634b86e2016-09-01 14:54:53882 (other.first_packet_time_ms < first_packet_time_ms ||
883 first_packet_time_ms == -1)) {
asapersson@webrtc.org44149392015-02-04 08:34:47884 // Use oldest time.
885 first_packet_time_ms = other.first_packet_time_ms;
886 }
887 }
888
Erik Språng22c2b482016-03-01 08:40:42889 void Subtract(const StreamDataCounters& other) {
890 transmitted.Subtract(other.transmitted);
891 retransmitted.Subtract(other.retransmitted);
892 fec.Subtract(other.fec);
893 if (other.first_packet_time_ms != -1 &&
894 (other.first_packet_time_ms > first_packet_time_ms ||
895 first_packet_time_ms == -1)) {
896 // Use youngest time.
897 first_packet_time_ms = other.first_packet_time_ms;
898 }
899 }
900
asapersson@webrtc.org44149392015-02-04 08:34:47901 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
902 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
903 }
904
905 // Returns the number of bytes corresponding to the actual media payload (i.e.
906 // RTP headers, padding, retransmissions and fec packets are excluded).
907 // Note this function does not have meaning for an RTX stream.
908 size_t MediaPayloadBytes() const {
909 return transmitted.payload_bytes - retransmitted.payload_bytes -
910 fec.payload_bytes;
911 }
912
solenberg634b86e2016-09-01 14:54:53913 int64_t first_packet_time_ms; // Time when first packet is sent/received.
914 RtpPacketCounter transmitted; // Number of transmitted packets/bytes.
asapersson@webrtc.org44149392015-02-04 08:34:47915 RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes.
solenberg634b86e2016-09-01 14:54:53916 RtpPacketCounter fec; // Number of redundancy packets/bytes.
asapersson@webrtc.org44149392015-02-04 08:34:47917};
918
919// Callback, called whenever byte/packet counts have been updated.
920class StreamDataCountersCallback {
921 public:
922 virtual ~StreamDataCountersCallback() {}
923
924 virtual void DataCountersUpdated(const StreamDataCounters& counters,
925 uint32_t ssrc) = 0;
926};
pbosda903ea2015-10-02 09:36:56927
928// RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size
929// RTCP mode is described by RFC 5506.
930enum class RtcpMode { kOff, kCompound, kReducedSize };
931
pbos1ba8d392016-05-02 03:18:34932enum NetworkState {
933 kNetworkUp,
934 kNetworkDown,
935};
936
sprang168794c2017-07-06 11:38:06937struct RtpKeepAliveConfig {
938 // If no packet has been sent for |timeout_interval_ms|, send a keep-alive
939 // packet. The keep-alive packet is an empty (no payload) RTP packet with a
940 // payload type of 20 as long as the other end has not negotiated the use of
941 // this value. If this value has already been negotiated, then some other
942 // unused static payload type from table 5 of RFC 3551 shall be used and set
943 // in |payload_type|.
944 int64_t timeout_interval_ms = -1;
945 uint8_t payload_type = 20;
946};
947
niklase@google.com470e71d2011-07-07 08:21:25948} // namespace webrtc
andrew@webrtc.orgeda189b2013-09-09 17:50:10949
950#endif // WEBRTC_COMMON_TYPES_H_