OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_COMMON_TYPES_H_ | 11 #ifndef WEBRTC_COMMON_TYPES_H_ |
12 #define WEBRTC_COMMON_TYPES_H_ | 12 #define WEBRTC_COMMON_TYPES_H_ |
13 | 13 |
14 #include <assert.h> | 14 #include <assert.h> |
15 #include <stddef.h> | 15 #include <stddef.h> |
16 #include <string.h> | 16 #include <string.h> |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
22 | 22 |
23 #if defined(_MSC_VER) | 23 #if defined(_MSC_VER) |
24 // Disable "new behavior: elements of array will be default initialized" | 24 // Disable "new behavior: elements of array will be default initialized" |
25 // warning. Affects OverUseDetectorOptions. | 25 // warning. Affects OverUseDetectorOptions. |
26 #pragma warning(disable:4351) | 26 #pragma warning(disable : 4351) |
27 #endif | 27 #endif |
28 | 28 |
29 #ifdef WEBRTC_EXPORT | 29 #ifdef WEBRTC_EXPORT |
30 #define WEBRTC_DLLEXPORT _declspec(dllexport) | 30 #define WEBRTC_DLLEXPORT _declspec(dllexport) |
31 #elif WEBRTC_DLL | 31 #elif WEBRTC_DLL |
32 #define WEBRTC_DLLEXPORT _declspec(dllimport) | 32 #define WEBRTC_DLLEXPORT _declspec(dllimport) |
33 #else | 33 #else |
34 #define WEBRTC_DLLEXPORT | 34 #define WEBRTC_DLLEXPORT |
35 #endif | 35 #endif |
36 | 36 |
(...skipping 30 matching lines...) Expand all Loading... |
67 virtual int Read(void* buf, size_t len) = 0; | 67 virtual int Read(void* buf, size_t len) = 0; |
68 }; | 68 }; |
69 | 69 |
70 class OutStream : public RewindableStream { | 70 class OutStream : public RewindableStream { |
71 public: | 71 public: |
72 // Writes |len| bytes from |buf| to file. The actual writing may happen | 72 // Writes |len| bytes from |buf| to file. The actual writing may happen |
73 // some time later. Call Flush() to force a write. | 73 // some time later. Call Flush() to force a write. |
74 virtual bool Write(const void* buf, size_t len) = 0; | 74 virtual bool Write(const void* buf, size_t len) = 0; |
75 }; | 75 }; |
76 | 76 |
77 enum TraceModule | 77 enum TraceModule { |
78 { | 78 kTraceUndefined = 0, |
79 kTraceUndefined = 0, | 79 // not a module, triggered from the engine code |
80 // not a module, triggered from the engine code | 80 kTraceVoice = 0x0001, |
81 kTraceVoice = 0x0001, | 81 // not a module, triggered from the engine code |
82 // not a module, triggered from the engine code | 82 kTraceVideo = 0x0002, |
83 kTraceVideo = 0x0002, | 83 // not a module, triggered from the utility code |
84 // not a module, triggered from the utility code | 84 kTraceUtility = 0x0003, |
85 kTraceUtility = 0x0003, | 85 kTraceRtpRtcp = 0x0004, |
86 kTraceRtpRtcp = 0x0004, | 86 kTraceTransport = 0x0005, |
87 kTraceTransport = 0x0005, | 87 kTraceSrtp = 0x0006, |
88 kTraceSrtp = 0x0006, | 88 kTraceAudioCoding = 0x0007, |
89 kTraceAudioCoding = 0x0007, | 89 kTraceAudioMixerServer = 0x0008, |
90 kTraceAudioMixerServer = 0x0008, | 90 kTraceAudioMixerClient = 0x0009, |
91 kTraceAudioMixerClient = 0x0009, | 91 kTraceFile = 0x000a, |
92 kTraceFile = 0x000a, | 92 kTraceAudioProcessing = 0x000b, |
93 kTraceAudioProcessing = 0x000b, | 93 kTraceVideoCoding = 0x0010, |
94 kTraceVideoCoding = 0x0010, | 94 kTraceVideoMixer = 0x0011, |
95 kTraceVideoMixer = 0x0011, | 95 kTraceAudioDevice = 0x0012, |
96 kTraceAudioDevice = 0x0012, | 96 kTraceVideoRenderer = 0x0014, |
97 kTraceVideoRenderer = 0x0014, | 97 kTraceVideoCapture = 0x0015, |
98 kTraceVideoCapture = 0x0015, | 98 kTraceRemoteBitrateEstimator = 0x0017, |
99 kTraceRemoteBitrateEstimator = 0x0017, | |
100 }; | 99 }; |
101 | 100 |
102 enum TraceLevel | 101 enum TraceLevel { |
103 { | 102 kTraceNone = 0x0000, // no trace |
104 kTraceNone = 0x0000, // no trace | 103 kTraceStateInfo = 0x0001, |
105 kTraceStateInfo = 0x0001, | 104 kTraceWarning = 0x0002, |
106 kTraceWarning = 0x0002, | 105 kTraceError = 0x0004, |
107 kTraceError = 0x0004, | 106 kTraceCritical = 0x0008, |
108 kTraceCritical = 0x0008, | 107 kTraceApiCall = 0x0010, |
109 kTraceApiCall = 0x0010, | 108 kTraceDefault = 0x00ff, |
110 kTraceDefault = 0x00ff, | |
111 | 109 |
112 kTraceModuleCall = 0x0020, | 110 kTraceModuleCall = 0x0020, |
113 kTraceMemory = 0x0100, // memory info | 111 kTraceMemory = 0x0100, // memory info |
114 kTraceTimer = 0x0200, // timing info | 112 kTraceTimer = 0x0200, // timing info |
115 kTraceStream = 0x0400, // "continuous" stream of data | 113 kTraceStream = 0x0400, // "continuous" stream of data |
116 | 114 |
117 // used for debug purposes | 115 // used for debug purposes |
118 kTraceDebug = 0x0800, // debug | 116 kTraceDebug = 0x0800, // debug |
119 kTraceInfo = 0x1000, // debug info | 117 kTraceInfo = 0x1000, // debug info |
120 | 118 |
121 // Non-verbose level used by LS_INFO of logging.h. Do not use directly. | 119 // Non-verbose level used by LS_INFO of logging.h. Do not use directly. |
122 kTraceTerseInfo = 0x2000, | 120 kTraceTerseInfo = 0x2000, |
123 | 121 |
124 kTraceAll = 0xffff | 122 kTraceAll = 0xffff |
125 }; | 123 }; |
126 | 124 |
127 // External Trace API | 125 // External Trace API |
128 class TraceCallback { | 126 class TraceCallback { |
129 public: | 127 public: |
130 virtual void Print(TraceLevel level, const char* message, int length) = 0; | 128 virtual void Print(TraceLevel level, const char* message, int length) = 0; |
131 | 129 |
132 protected: | 130 protected: |
133 virtual ~TraceCallback() {} | 131 virtual ~TraceCallback() {} |
134 TraceCallback() {} | 132 TraceCallback() {} |
135 }; | 133 }; |
136 | 134 |
137 enum FileFormats | 135 enum FileFormats { |
138 { | 136 kFileFormatWavFile = 1, |
139 kFileFormatWavFile = 1, | 137 kFileFormatCompressedFile = 2, |
140 kFileFormatCompressedFile = 2, | 138 kFileFormatPreencodedFile = 4, |
141 kFileFormatPreencodedFile = 4, | 139 kFileFormatPcm16kHzFile = 7, |
142 kFileFormatPcm16kHzFile = 7, | 140 kFileFormatPcm8kHzFile = 8, |
143 kFileFormatPcm8kHzFile = 8, | 141 kFileFormatPcm32kHzFile = 9 |
144 kFileFormatPcm32kHzFile = 9 | |
145 }; | 142 }; |
146 | 143 |
147 enum ProcessingTypes | 144 enum ProcessingTypes { |
148 { | 145 kPlaybackPerChannel = 0, |
149 kPlaybackPerChannel = 0, | 146 kPlaybackAllChannelsMixed, |
150 kPlaybackAllChannelsMixed, | 147 kRecordingPerChannel, |
151 kRecordingPerChannel, | 148 kRecordingAllChannelsMixed, |
152 kRecordingAllChannelsMixed, | 149 kRecordingPreprocessing |
153 kRecordingPreprocessing | |
154 }; | 150 }; |
155 | 151 |
156 enum FrameType { | 152 enum FrameType { |
157 kEmptyFrame = 0, | 153 kEmptyFrame = 0, |
158 kAudioFrameSpeech = 1, | 154 kAudioFrameSpeech = 1, |
159 kAudioFrameCN = 2, | 155 kAudioFrameCN = 2, |
160 kVideoFrameKey = 3, | 156 kVideoFrameKey = 3, |
161 kVideoFrameDelta = 4, | 157 kVideoFrameDelta = 4, |
162 }; | 158 }; |
163 | 159 |
164 // Statistics for an RTCP channel | 160 // Statistics for an RTCP channel |
165 struct RtcpStatistics { | 161 struct RtcpStatistics { |
166 RtcpStatistics() | 162 RtcpStatistics() |
167 : fraction_lost(0), | 163 : fraction_lost(0), |
168 cumulative_lost(0), | 164 cumulative_lost(0), |
169 extended_max_sequence_number(0), | 165 extended_max_sequence_number(0), |
170 jitter(0) {} | 166 jitter(0) {} |
171 | 167 |
172 uint8_t fraction_lost; | 168 uint8_t fraction_lost; |
173 uint32_t cumulative_lost; | 169 uint32_t cumulative_lost; |
174 uint32_t extended_max_sequence_number; | 170 uint32_t extended_max_sequence_number; |
175 uint32_t jitter; | 171 uint32_t jitter; |
176 }; | 172 }; |
177 | 173 |
178 class RtcpStatisticsCallback { | 174 class RtcpStatisticsCallback { |
179 public: | 175 public: |
180 virtual ~RtcpStatisticsCallback() {} | 176 virtual ~RtcpStatisticsCallback() {} |
181 | 177 |
182 virtual void StatisticsUpdated(const RtcpStatistics& statistics, | 178 virtual void StatisticsUpdated(const RtcpStatistics& statistics, |
183 uint32_t ssrc) = 0; | 179 uint32_t ssrc) = 0; |
184 virtual void CNameChanged(const char* cname, uint32_t ssrc) = 0; | 180 virtual void CNameChanged(const char* cname, uint32_t ssrc) = 0; |
185 }; | 181 }; |
186 | 182 |
187 // Statistics for RTCP packet types. | 183 // Statistics for RTCP packet types. |
188 struct RtcpPacketTypeCounter { | 184 struct RtcpPacketTypeCounter { |
189 RtcpPacketTypeCounter() | 185 RtcpPacketTypeCounter() |
190 : first_packet_time_ms(-1), | 186 : first_packet_time_ms(-1), |
191 nack_packets(0), | 187 nack_packets(0), |
192 fir_packets(0), | 188 fir_packets(0), |
193 pli_packets(0), | 189 pli_packets(0), |
194 nack_requests(0), | 190 nack_requests(0), |
195 unique_nack_requests(0) {} | 191 unique_nack_requests(0) {} |
196 | 192 |
197 void Add(const RtcpPacketTypeCounter& other) { | 193 void Add(const RtcpPacketTypeCounter& other) { |
198 nack_packets += other.nack_packets; | 194 nack_packets += other.nack_packets; |
199 fir_packets += other.fir_packets; | 195 fir_packets += other.fir_packets; |
200 pli_packets += other.pli_packets; | 196 pli_packets += other.pli_packets; |
201 nack_requests += other.nack_requests; | 197 nack_requests += other.nack_requests; |
202 unique_nack_requests += other.unique_nack_requests; | 198 unique_nack_requests += other.unique_nack_requests; |
203 if (other.first_packet_time_ms != -1 && | 199 if (other.first_packet_time_ms != -1 && |
204 (other.first_packet_time_ms < first_packet_time_ms || | 200 (other.first_packet_time_ms < first_packet_time_ms || |
205 first_packet_time_ms == -1)) { | 201 first_packet_time_ms == -1)) { |
206 // Use oldest time. | 202 // Use oldest time. |
207 first_packet_time_ms = other.first_packet_time_ms; | 203 first_packet_time_ms = other.first_packet_time_ms; |
208 } | 204 } |
209 } | 205 } |
210 | 206 |
211 void Subtract(const RtcpPacketTypeCounter& other) { | 207 void Subtract(const RtcpPacketTypeCounter& other) { |
212 nack_packets -= other.nack_packets; | 208 nack_packets -= other.nack_packets; |
213 fir_packets -= other.fir_packets; | 209 fir_packets -= other.fir_packets; |
214 pli_packets -= other.pli_packets; | 210 pli_packets -= other.pli_packets; |
215 nack_requests -= other.nack_requests; | 211 nack_requests -= other.nack_requests; |
216 unique_nack_requests -= other.unique_nack_requests; | 212 unique_nack_requests -= other.unique_nack_requests; |
217 if (other.first_packet_time_ms != -1 && | 213 if (other.first_packet_time_ms != -1 && |
218 (other.first_packet_time_ms > first_packet_time_ms || | 214 (other.first_packet_time_ms > first_packet_time_ms || |
219 first_packet_time_ms == -1)) { | 215 first_packet_time_ms == -1)) { |
220 // Use youngest time. | 216 // Use youngest time. |
221 first_packet_time_ms = other.first_packet_time_ms; | 217 first_packet_time_ms = other.first_packet_time_ms; |
222 } | 218 } |
223 } | 219 } |
224 | 220 |
225 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { | 221 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { |
226 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); | 222 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); |
227 } | 223 } |
228 | 224 |
229 int UniqueNackRequestsInPercent() const { | 225 int UniqueNackRequestsInPercent() const { |
230 if (nack_requests == 0) { | 226 if (nack_requests == 0) { |
231 return 0; | 227 return 0; |
232 } | 228 } |
233 return static_cast<int>( | 229 return static_cast<int>((unique_nack_requests * 100.0f / nack_requests) + |
234 (unique_nack_requests * 100.0f / nack_requests) + 0.5f); | 230 0.5f); |
235 } | 231 } |
236 | 232 |
237 int64_t first_packet_time_ms; // Time when first packet is sent/received. | 233 int64_t first_packet_time_ms; // Time when first packet is sent/received. |
238 uint32_t nack_packets; // Number of RTCP NACK packets. | 234 uint32_t nack_packets; // Number of RTCP NACK packets. |
239 uint32_t fir_packets; // Number of RTCP FIR packets. | 235 uint32_t fir_packets; // Number of RTCP FIR packets. |
240 uint32_t pli_packets; // Number of RTCP PLI packets. | 236 uint32_t pli_packets; // Number of RTCP PLI packets. |
241 uint32_t nack_requests; // Number of NACKed RTP packets. | 237 uint32_t nack_requests; // Number of NACKed RTP packets. |
242 uint32_t unique_nack_requests; // Number of unique NACKed RTP packets. | 238 uint32_t unique_nack_requests; // Number of unique NACKed RTP packets. |
243 }; | 239 }; |
244 | 240 |
245 class RtcpPacketTypeCounterObserver { | 241 class RtcpPacketTypeCounterObserver { |
246 public: | 242 public: |
247 virtual ~RtcpPacketTypeCounterObserver() {} | 243 virtual ~RtcpPacketTypeCounterObserver() {} |
248 virtual void RtcpPacketTypesCounterUpdated( | 244 virtual void RtcpPacketTypesCounterUpdated( |
249 uint32_t ssrc, | 245 uint32_t ssrc, |
250 const RtcpPacketTypeCounter& packet_counter) = 0; | 246 const RtcpPacketTypeCounter& packet_counter) = 0; |
251 }; | 247 }; |
252 | 248 |
253 // Rate statistics for a stream. | 249 // Rate statistics for a stream. |
254 struct BitrateStatistics { | 250 struct BitrateStatistics { |
255 BitrateStatistics() : bitrate_bps(0), packet_rate(0) {} | 251 BitrateStatistics() : bitrate_bps(0), packet_rate(0) {} |
256 | 252 |
257 uint32_t bitrate_bps; // Bitrate in bits per second. | 253 uint32_t bitrate_bps; // Bitrate in bits per second. |
258 uint32_t packet_rate; // Packet rate in packets per second. | 254 uint32_t packet_rate; // Packet rate in packets per second. |
259 }; | 255 }; |
260 | 256 |
261 // Callback, used to notify an observer whenever new rates have been estimated. | 257 // Callback, used to notify an observer whenever new rates have been estimated. |
262 class BitrateStatisticsObserver { | 258 class BitrateStatisticsObserver { |
263 public: | 259 public: |
264 virtual ~BitrateStatisticsObserver() {} | 260 virtual ~BitrateStatisticsObserver() {} |
265 | 261 |
266 virtual void Notify(uint32_t total_bitrate_bps, | 262 virtual void Notify(uint32_t total_bitrate_bps, |
267 uint32_t retransmit_bitrate_bps, | 263 uint32_t retransmit_bitrate_bps, |
268 uint32_t ssrc) = 0; | 264 uint32_t ssrc) = 0; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 int pltype; | 308 int pltype; |
313 char plname[RTP_PAYLOAD_NAME_SIZE]; | 309 char plname[RTP_PAYLOAD_NAME_SIZE]; |
314 int plfreq; | 310 int plfreq; |
315 int pacsize; | 311 int pacsize; |
316 size_t channels; | 312 size_t channels; |
317 int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file! | 313 int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file! |
318 | 314 |
319 bool operator==(const CodecInst& other) const { | 315 bool operator==(const CodecInst& other) const { |
320 return pltype == other.pltype && | 316 return pltype == other.pltype && |
321 (STR_CASE_CMP(plname, other.plname) == 0) && | 317 (STR_CASE_CMP(plname, other.plname) == 0) && |
322 plfreq == other.plfreq && | 318 plfreq == other.plfreq && pacsize == other.pacsize && |
323 pacsize == other.pacsize && | 319 channels == other.channels && rate == other.rate; |
324 channels == other.channels && | |
325 rate == other.rate; | |
326 } | 320 } |
327 | 321 |
328 bool operator!=(const CodecInst& other) const { | 322 bool operator!=(const CodecInst& other) const { return !(*this == other); } |
329 return !(*this == other); | |
330 } | |
331 }; | 323 }; |
332 | 324 |
333 // RTP | 325 // RTP |
334 enum {kRtpCsrcSize = 15}; // RFC 3550 page 13 | 326 enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13 |
335 | 327 |
336 enum PayloadFrequencies | 328 enum PayloadFrequencies { |
337 { | 329 kFreq8000Hz = 8000, |
338 kFreq8000Hz = 8000, | 330 kFreq16000Hz = 16000, |
339 kFreq16000Hz = 16000, | 331 kFreq32000Hz = 32000 |
340 kFreq32000Hz = 32000 | |
341 }; | 332 }; |
342 | 333 |
343 enum VadModes // degree of bandwidth reduction | 334 // Degree of bandwidth reduction. |
344 { | 335 enum VadModes { |
345 kVadConventional = 0, // lowest reduction | 336 kVadConventional = 0, // lowest reduction |
346 kVadAggressiveLow, | 337 kVadAggressiveLow, |
347 kVadAggressiveMid, | 338 kVadAggressiveMid, |
348 kVadAggressiveHigh // highest reduction | 339 kVadAggressiveHigh // highest reduction |
349 }; | 340 }; |
350 | 341 |
351 struct NetworkStatistics // NETEQ statistics | 342 // NETEQ statistics. |
352 { | 343 struct NetworkStatistics { |
353 // current jitter buffer size in ms | 344 // current jitter buffer size in ms |
354 uint16_t currentBufferSize; | 345 uint16_t currentBufferSize; |
355 // preferred (optimal) buffer size in ms | 346 // preferred (optimal) buffer size in ms |
356 uint16_t preferredBufferSize; | 347 uint16_t preferredBufferSize; |
357 // adding extra delay due to "peaky jitter" | 348 // adding extra delay due to "peaky jitter" |
358 bool jitterPeaksFound; | 349 bool jitterPeaksFound; |
359 // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. | 350 // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. |
360 uint16_t currentPacketLossRate; | 351 uint16_t currentPacketLossRate; |
361 // Late loss rate; fraction between 0 and 1, scaled to Q14. | 352 // Late loss rate; fraction between 0 and 1, scaled to Q14. |
362 uint16_t currentDiscardRate; | 353 uint16_t currentDiscardRate; |
363 // fraction (of original stream) of synthesized audio inserted through | 354 // fraction (of original stream) of synthesized audio inserted through |
364 // expansion (in Q14) | 355 // expansion (in Q14) |
365 uint16_t currentExpandRate; | 356 uint16_t currentExpandRate; |
366 // fraction (of original stream) of synthesized speech inserted through | 357 // fraction (of original stream) of synthesized speech inserted through |
367 // expansion (in Q14) | 358 // expansion (in Q14) |
368 uint16_t currentSpeechExpandRate; | 359 uint16_t currentSpeechExpandRate; |
369 // fraction of synthesized speech inserted through pre-emptive expansion | 360 // fraction of synthesized speech inserted through pre-emptive expansion |
370 // (in Q14) | 361 // (in Q14) |
371 uint16_t currentPreemptiveRate; | 362 uint16_t currentPreemptiveRate; |
372 // fraction of data removed through acceleration (in Q14) | 363 // fraction of data removed through acceleration (in Q14) |
373 uint16_t currentAccelerateRate; | 364 uint16_t currentAccelerateRate; |
374 // fraction of data coming from secondary decoding (in Q14) | 365 // fraction of data coming from secondary decoding (in Q14) |
375 uint16_t currentSecondaryDecodedRate; | 366 uint16_t currentSecondaryDecodedRate; |
376 // clock-drift in parts-per-million (negative or positive) | 367 // clock-drift in parts-per-million (negative or positive) |
377 int32_t clockDriftPPM; | 368 int32_t clockDriftPPM; |
378 // average packet waiting time in the jitter buffer (ms) | 369 // average packet waiting time in the jitter buffer (ms) |
379 int meanWaitingTimeMs; | 370 int meanWaitingTimeMs; |
380 // median packet waiting time in the jitter buffer (ms) | 371 // median packet waiting time in the jitter buffer (ms) |
381 int medianWaitingTimeMs; | 372 int medianWaitingTimeMs; |
382 // min packet waiting time in the jitter buffer (ms) | 373 // min packet waiting time in the jitter buffer (ms) |
383 int minWaitingTimeMs; | 374 int minWaitingTimeMs; |
384 // max packet waiting time in the jitter buffer (ms) | 375 // max packet waiting time in the jitter buffer (ms) |
385 int maxWaitingTimeMs; | 376 int maxWaitingTimeMs; |
386 // added samples in off mode due to packet loss | 377 // added samples in off mode due to packet loss |
387 size_t addedSamples; | 378 size_t addedSamples; |
388 }; | 379 }; |
389 | 380 |
390 // Statistics for calls to AudioCodingModule::PlayoutData10Ms(). | 381 // Statistics for calls to AudioCodingModule::PlayoutData10Ms(). |
391 struct AudioDecodingCallStats { | 382 struct AudioDecodingCallStats { |
392 AudioDecodingCallStats() | 383 AudioDecodingCallStats() |
393 : calls_to_silence_generator(0), | 384 : calls_to_silence_generator(0), |
394 calls_to_neteq(0), | 385 calls_to_neteq(0), |
395 decoded_normal(0), | 386 decoded_normal(0), |
396 decoded_plc(0), | 387 decoded_plc(0), |
397 decoded_cng(0), | 388 decoded_cng(0), |
398 decoded_plc_cng(0) {} | 389 decoded_plc_cng(0) {} |
399 | 390 |
400 int calls_to_silence_generator; // Number of calls where silence generated, | 391 int calls_to_silence_generator; // Number of calls where silence generated, |
401 // and NetEq was disengaged from decoding. | 392 // and NetEq was disengaged from decoding. |
402 int calls_to_neteq; // Number of calls to NetEq. | 393 int calls_to_neteq; // Number of calls to NetEq. |
403 int decoded_normal; // Number of calls where audio RTP packet decoded. | 394 int decoded_normal; // Number of calls where audio RTP packet decoded. |
404 int decoded_plc; // Number of calls resulted in PLC. | 395 int decoded_plc; // Number of calls resulted in PLC. |
405 int decoded_cng; // Number of calls where comfort noise generated due to DTX. | 396 int decoded_cng; // Number of calls where comfort noise generated due to DTX. |
406 int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. | 397 int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. |
407 }; | 398 }; |
408 | 399 |
409 enum NsModes // type of Noise Suppression | 400 // Type of Noise Suppression. |
410 { | 401 enum NsModes { |
411 kNsUnchanged = 0, // previously set mode | 402 kNsUnchanged = 0, // previously set mode |
412 kNsDefault, // platform default | 403 kNsDefault, // platform default |
413 kNsConference, // conferencing default | 404 kNsConference, // conferencing default |
414 kNsLowSuppression, // lowest suppression | 405 kNsLowSuppression, // lowest suppression |
415 kNsModerateSuppression, | 406 kNsModerateSuppression, |
416 kNsHighSuppression, | 407 kNsHighSuppression, |
417 kNsVeryHighSuppression, // highest suppression | 408 kNsVeryHighSuppression, // highest suppression |
418 }; | 409 }; |
419 | 410 |
420 enum AgcModes // type of Automatic Gain Control | 411 // Type of Automatic Gain Control. |
421 { | 412 enum AgcModes { |
422 kAgcUnchanged = 0, // previously set mode | 413 kAgcUnchanged = 0, // previously set mode |
423 kAgcDefault, // platform default | 414 kAgcDefault, // platform default |
424 // adaptive mode for use when analog volume control exists (e.g. for | 415 // adaptive mode for use when analog volume control exists (e.g. for |
425 // PC softphone) | 416 // PC softphone) |
426 kAgcAdaptiveAnalog, | 417 kAgcAdaptiveAnalog, |
427 // scaling takes place in the digital domain (e.g. for conference servers | 418 // scaling takes place in the digital domain (e.g. for conference servers |
428 // and embedded devices) | 419 // and embedded devices) |
429 kAgcAdaptiveDigital, | 420 kAgcAdaptiveDigital, |
430 // can be used on embedded devices where the capture signal level | 421 // can be used on embedded devices where the capture signal level |
431 // is predictable | 422 // is predictable |
432 kAgcFixedDigital | 423 kAgcFixedDigital |
433 }; | 424 }; |
434 | 425 |
435 // EC modes | 426 // Type of Echo Control. |
436 enum EcModes // type of Echo Control | 427 enum EcModes { |
437 { | 428 kEcUnchanged = 0, // previously set mode |
438 kEcUnchanged = 0, // previously set mode | 429 kEcDefault, // platform default |
439 kEcDefault, // platform default | 430 kEcConference, // conferencing default (aggressive AEC) |
440 kEcConference, // conferencing default (aggressive AEC) | 431 kEcAec, // Acoustic Echo Cancellation |
441 kEcAec, // Acoustic Echo Cancellation | 432 kEcAecm, // AEC mobile |
442 kEcAecm, // AEC mobile | |
443 }; | 433 }; |
444 | 434 |
445 // AECM modes | 435 // Mode of AECM. |
446 enum AecmModes // mode of AECM | 436 enum AecmModes { |
447 { | 437 kAecmQuietEarpieceOrHeadset = 0, |
448 kAecmQuietEarpieceOrHeadset = 0, | 438 // Quiet earpiece or headset use |
449 // Quiet earpiece or headset use | 439 kAecmEarpiece, // most earpiece use |
450 kAecmEarpiece, // most earpiece use | 440 kAecmLoudEarpiece, // Loud earpiece or quiet speakerphone use |
451 kAecmLoudEarpiece, // Loud earpiece or quiet speakerphone use | 441 kAecmSpeakerphone, // most speakerphone use (default) |
452 kAecmSpeakerphone, // most speakerphone use (default) | 442 kAecmLoudSpeakerphone // Loud speakerphone |
453 kAecmLoudSpeakerphone // Loud speakerphone | |
454 }; | 443 }; |
455 | 444 |
456 // AGC configuration parameters | 445 // AGC configuration parameters |
457 struct AgcConfig | 446 struct AgcConfig { |
458 { | 447 unsigned short targetLeveldBOv; |
459 unsigned short targetLeveldBOv; | 448 unsigned short digitalCompressionGaindB; |
460 unsigned short digitalCompressionGaindB; | 449 bool limiterEnable; |
461 bool limiterEnable; | |
462 }; | 450 }; |
463 | 451 |
464 enum StereoChannel | 452 enum StereoChannel { kStereoLeft = 0, kStereoRight, kStereoBoth }; |
465 { | |
466 kStereoLeft = 0, | |
467 kStereoRight, | |
468 kStereoBoth | |
469 }; | |
470 | 453 |
471 // Audio device layers | 454 // Audio device layers |
472 enum AudioLayers | 455 enum AudioLayers { |
473 { | 456 kAudioPlatformDefault = 0, |
474 kAudioPlatformDefault = 0, | 457 kAudioWindowsWave = 1, |
475 kAudioWindowsWave = 1, | 458 kAudioWindowsCore = 2, |
476 kAudioWindowsCore = 2, | 459 kAudioLinuxAlsa = 3, |
477 kAudioLinuxAlsa = 3, | 460 kAudioLinuxPulse = 4 |
478 kAudioLinuxPulse = 4 | |
479 }; | 461 }; |
480 | 462 |
481 // ================================================================== | 463 // ================================================================== |
482 // Video specific types | 464 // Video specific types |
483 // ================================================================== | 465 // ================================================================== |
484 | 466 |
485 // Raw video types | 467 // Raw video types |
486 enum RawVideoType | 468 enum RawVideoType { |
487 { | 469 kVideoI420 = 0, |
488 kVideoI420 = 0, | 470 kVideoYV12 = 1, |
489 kVideoYV12 = 1, | 471 kVideoYUY2 = 2, |
490 kVideoYUY2 = 2, | 472 kVideoUYVY = 3, |
491 kVideoUYVY = 3, | 473 kVideoIYUV = 4, |
492 kVideoIYUV = 4, | 474 kVideoARGB = 5, |
493 kVideoARGB = 5, | 475 kVideoRGB24 = 6, |
494 kVideoRGB24 = 6, | 476 kVideoRGB565 = 7, |
495 kVideoRGB565 = 7, | 477 kVideoARGB4444 = 8, |
496 kVideoARGB4444 = 8, | 478 kVideoARGB1555 = 9, |
497 kVideoARGB1555 = 9, | 479 kVideoMJPEG = 10, |
498 kVideoMJPEG = 10, | 480 kVideoNV12 = 11, |
499 kVideoNV12 = 11, | 481 kVideoNV21 = 12, |
500 kVideoNV21 = 12, | 482 kVideoBGRA = 13, |
501 kVideoBGRA = 13, | 483 kVideoUnknown = 99 |
502 kVideoUnknown = 99 | |
503 }; | 484 }; |
504 | 485 |
505 // Video codec | 486 // Video codec |
506 enum { kConfigParameterSize = 128}; | 487 enum { kConfigParameterSize = 128 }; |
507 enum { kPayloadNameSize = 32}; | 488 enum { kPayloadNameSize = 32 }; |
508 enum { kMaxSimulcastStreams = 4}; | 489 enum { kMaxSimulcastStreams = 4 }; |
509 enum { kMaxSpatialLayers = 5 }; | 490 enum { kMaxSpatialLayers = 5 }; |
510 enum { kMaxTemporalStreams = 4}; | 491 enum { kMaxTemporalStreams = 4 }; |
511 | 492 |
512 enum VideoCodecComplexity | 493 enum VideoCodecComplexity { |
513 { | 494 kComplexityNormal = 0, |
514 kComplexityNormal = 0, | 495 kComplexityHigh = 1, |
515 kComplexityHigh = 1, | 496 kComplexityHigher = 2, |
516 kComplexityHigher = 2, | 497 kComplexityMax = 3 |
517 kComplexityMax = 3 | |
518 }; | 498 }; |
519 | 499 |
520 enum VideoCodecProfile | 500 enum VideoCodecProfile { kProfileBase = 0x00, kProfileMain = 0x01 }; |
521 { | |
522 kProfileBase = 0x00, | |
523 kProfileMain = 0x01 | |
524 }; | |
525 | 501 |
526 enum VP8ResilienceMode { | 502 enum VP8ResilienceMode { |
527 kResilienceOff, // The stream produced by the encoder requires a | 503 kResilienceOff, // The stream produced by the encoder requires a |
528 // recovery frame (typically a key frame) to be | 504 // recovery frame (typically a key frame) to be |
529 // decodable after a packet loss. | 505 // decodable after a packet loss. |
530 kResilientStream, // A stream produced by the encoder is resilient to | 506 kResilientStream, // A stream produced by the encoder is resilient to |
531 // packet losses, but packets within a frame subsequent | 507 // packet losses, but packets within a frame subsequent |
532 // to a loss can't be decoded. | 508 // to a loss can't be decoded. |
533 kResilientFrames // Same as kResilientStream but with added resilience | 509 kResilientFrames // Same as kResilientStream but with added resilience |
534 // within a frame. | 510 // within a frame. |
535 }; | 511 }; |
536 | 512 |
537 class TemporalLayersFactory; | 513 class TemporalLayersFactory; |
538 // VP8 specific | 514 // VP8 specific |
539 struct VideoCodecVP8 { | 515 struct VideoCodecVP8 { |
540 bool pictureLossIndicationOn; | 516 bool pictureLossIndicationOn; |
541 bool feedbackModeOn; | 517 bool feedbackModeOn; |
542 VideoCodecComplexity complexity; | 518 VideoCodecComplexity complexity; |
543 VP8ResilienceMode resilience; | 519 VP8ResilienceMode resilience; |
544 unsigned char numberOfTemporalLayers; | 520 unsigned char numberOfTemporalLayers; |
545 bool denoisingOn; | 521 bool denoisingOn; |
546 bool errorConcealmentOn; | 522 bool errorConcealmentOn; |
547 bool automaticResizeOn; | 523 bool automaticResizeOn; |
548 bool frameDroppingOn; | 524 bool frameDroppingOn; |
549 int keyFrameInterval; | 525 int keyFrameInterval; |
550 const TemporalLayersFactory* tl_factory; | 526 const TemporalLayersFactory* tl_factory; |
551 }; | 527 }; |
552 | 528 |
553 // VP9 specific. | 529 // VP9 specific. |
554 struct VideoCodecVP9 { | 530 struct VideoCodecVP9 { |
555 VideoCodecComplexity complexity; | 531 VideoCodecComplexity complexity; |
556 int resilience; | 532 int resilience; |
557 unsigned char numberOfTemporalLayers; | 533 unsigned char numberOfTemporalLayers; |
558 bool denoisingOn; | 534 bool denoisingOn; |
559 bool frameDroppingOn; | 535 bool frameDroppingOn; |
560 int keyFrameInterval; | 536 int keyFrameInterval; |
561 bool adaptiveQpMode; | 537 bool adaptiveQpMode; |
562 bool automaticResizeOn; | 538 bool automaticResizeOn; |
563 unsigned char numberOfSpatialLayers; | 539 unsigned char numberOfSpatialLayers; |
564 bool flexibleMode; | 540 bool flexibleMode; |
565 }; | 541 }; |
566 | 542 |
567 // H264 specific. | 543 // H264 specific. |
568 struct VideoCodecH264 { | 544 struct VideoCodecH264 { |
569 VideoCodecProfile profile; | 545 VideoCodecProfile profile; |
570 bool frameDroppingOn; | 546 bool frameDroppingOn; |
571 int keyFrameInterval; | 547 int keyFrameInterval; |
572 // These are NULL/0 if not externally negotiated. | 548 // These are NULL/0 if not externally negotiated. |
573 const uint8_t* spsData; | 549 const uint8_t* spsData; |
574 size_t spsLen; | 550 size_t spsLen; |
575 const uint8_t* ppsData; | 551 const uint8_t* ppsData; |
576 size_t ppsLen; | 552 size_t ppsLen; |
577 }; | 553 }; |
578 | 554 |
579 // Video codec types | 555 // Video codec types |
580 enum VideoCodecType { | 556 enum VideoCodecType { |
581 kVideoCodecVP8, | 557 kVideoCodecVP8, |
582 kVideoCodecVP9, | 558 kVideoCodecVP9, |
583 kVideoCodecH264, | 559 kVideoCodecH264, |
584 kVideoCodecI420, | 560 kVideoCodecI420, |
585 kVideoCodecRED, | 561 kVideoCodecRED, |
586 kVideoCodecULPFEC, | 562 kVideoCodecULPFEC, |
587 kVideoCodecGeneric, | 563 kVideoCodecGeneric, |
588 kVideoCodecUnknown | 564 kVideoCodecUnknown |
589 }; | 565 }; |
590 | 566 |
591 union VideoCodecUnion { | 567 union VideoCodecUnion { |
592 VideoCodecVP8 VP8; | 568 VideoCodecVP8 VP8; |
593 VideoCodecVP9 VP9; | 569 VideoCodecVP9 VP9; |
594 VideoCodecH264 H264; | 570 VideoCodecH264 H264; |
595 }; | 571 }; |
596 | 572 |
597 | |
598 // Simulcast is when the same stream is encoded multiple times with different | 573 // Simulcast is when the same stream is encoded multiple times with different |
599 // settings such as resolution. | 574 // settings such as resolution. |
600 struct SimulcastStream { | 575 struct SimulcastStream { |
601 unsigned short width; | 576 unsigned short width; |
602 unsigned short height; | 577 unsigned short height; |
603 unsigned char numberOfTemporalLayers; | 578 unsigned char numberOfTemporalLayers; |
604 unsigned int maxBitrate; // kilobits/sec. | 579 unsigned int maxBitrate; // kilobits/sec. |
605 unsigned int targetBitrate; // kilobits/sec. | 580 unsigned int targetBitrate; // kilobits/sec. |
606 unsigned int minBitrate; // kilobits/sec. | 581 unsigned int minBitrate; // kilobits/sec. |
607 unsigned int qpMax; // minimum quality | 582 unsigned int qpMax; // minimum quality |
608 }; | 583 }; |
609 | 584 |
610 struct SpatialLayer { | 585 struct SpatialLayer { |
611 int scaling_factor_num; | 586 int scaling_factor_num; |
612 int scaling_factor_den; | 587 int scaling_factor_den; |
613 int target_bitrate_bps; | 588 int target_bitrate_bps; |
614 // TODO(ivica): Add max_quantizer and min_quantizer? | 589 // TODO(ivica): Add max_quantizer and min_quantizer? |
615 }; | 590 }; |
616 | 591 |
617 enum VideoCodecMode { | 592 enum VideoCodecMode { kRealtimeVideo, kScreensharing }; |
618 kRealtimeVideo, | |
619 kScreensharing | |
620 }; | |
621 | 593 |
622 // Common video codec properties | 594 // Common video codec properties |
623 struct VideoCodec { | 595 struct VideoCodec { |
624 VideoCodecType codecType; | 596 VideoCodecType codecType; |
625 char plName[kPayloadNameSize]; | 597 char plName[kPayloadNameSize]; |
626 unsigned char plType; | 598 unsigned char plType; |
627 | 599 |
628 unsigned short width; | 600 unsigned short width; |
629 unsigned short height; | 601 unsigned short height; |
630 | 602 |
631 unsigned int startBitrate; // kilobits/sec. | 603 unsigned int startBitrate; // kilobits/sec. |
632 unsigned int maxBitrate; // kilobits/sec. | 604 unsigned int maxBitrate; // kilobits/sec. |
633 unsigned int minBitrate; // kilobits/sec. | 605 unsigned int minBitrate; // kilobits/sec. |
634 unsigned int targetBitrate; // kilobits/sec. | 606 unsigned int targetBitrate; // kilobits/sec. |
635 | 607 |
636 unsigned char maxFramerate; | 608 unsigned char maxFramerate; |
637 | 609 |
638 VideoCodecUnion codecSpecific; | 610 VideoCodecUnion codecSpecific; |
639 | 611 |
640 unsigned int qpMax; | 612 unsigned int qpMax; |
641 unsigned char numberOfSimulcastStreams; | 613 unsigned char numberOfSimulcastStreams; |
642 SimulcastStream simulcastStream[kMaxSimulcastStreams]; | 614 SimulcastStream simulcastStream[kMaxSimulcastStreams]; |
643 SpatialLayer spatialLayers[kMaxSpatialLayers]; | 615 SpatialLayer spatialLayers[kMaxSpatialLayers]; |
644 | 616 |
645 VideoCodecMode mode; | 617 VideoCodecMode mode; |
646 bool expect_encode_from_texture; | 618 bool expect_encode_from_texture; |
647 | 619 |
648 bool operator==(const VideoCodec& other) const = delete; | 620 bool operator==(const VideoCodec& other) const = delete; |
649 bool operator!=(const VideoCodec& other) const = delete; | 621 bool operator!=(const VideoCodec& other) const = delete; |
650 }; | 622 }; |
651 | 623 |
652 // Bandwidth over-use detector options. These are used to drive | 624 // Bandwidth over-use detector options. These are used to drive |
653 // experimentation with bandwidth estimation parameters. | 625 // experimentation with bandwidth estimation parameters. |
654 // See modules/remote_bitrate_estimator/overuse_detector.h | 626 // See modules/remote_bitrate_estimator/overuse_detector.h |
655 struct OverUseDetectorOptions { | 627 struct OverUseDetectorOptions { |
656 OverUseDetectorOptions() | 628 OverUseDetectorOptions() |
657 : initial_slope(8.0/512.0), | 629 : initial_slope(8.0 / 512.0), |
658 initial_offset(0), | 630 initial_offset(0), |
659 initial_e(), | 631 initial_e(), |
660 initial_process_noise(), | 632 initial_process_noise(), |
661 initial_avg_noise(0.0), | 633 initial_avg_noise(0.0), |
662 initial_var_noise(50) { | 634 initial_var_noise(50) { |
663 initial_e[0][0] = 100; | 635 initial_e[0][0] = 100; |
664 initial_e[1][1] = 1e-1; | 636 initial_e[1][1] = 1e-1; |
665 initial_e[0][1] = initial_e[1][0] = 0; | 637 initial_e[0][1] = initial_e[1][0] = 0; |
666 initial_process_noise[0] = 1e-13; | 638 initial_process_noise[0] = 1e-13; |
667 initial_process_noise[1] = 1e-3; | 639 initial_process_noise[1] = 1e-3; |
668 } | 640 } |
669 double initial_slope; | 641 double initial_slope; |
670 double initial_offset; | 642 double initial_offset; |
671 double initial_e[2][2]; | 643 double initial_e[2][2]; |
672 double initial_process_noise[2]; | 644 double initial_process_noise[2]; |
673 double initial_avg_noise; | 645 double initial_avg_noise; |
674 double initial_var_noise; | 646 double initial_var_noise; |
675 }; | 647 }; |
676 | 648 |
677 // This structure will have the information about when packet is actually | 649 // This structure will have the information about when packet is actually |
678 // received by socket. | 650 // received by socket. |
679 struct PacketTime { | 651 struct PacketTime { |
680 PacketTime() : timestamp(-1), not_before(-1) {} | 652 PacketTime() : timestamp(-1), not_before(-1) {} |
681 PacketTime(int64_t timestamp, int64_t not_before) | 653 PacketTime(int64_t timestamp, int64_t not_before) |
682 : timestamp(timestamp), not_before(not_before) { | 654 : timestamp(timestamp), not_before(not_before) {} |
683 } | |
684 | 655 |
685 int64_t timestamp; // Receive time after socket delivers the data. | 656 int64_t timestamp; // Receive time after socket delivers the data. |
686 int64_t not_before; // Earliest possible time the data could have arrived, | 657 int64_t not_before; // Earliest possible time the data could have arrived, |
687 // indicating the potential error in the |timestamp| | 658 // indicating the potential error in the |timestamp| |
688 // value,in case the system is busy. | 659 // value,in case the system is busy. |
689 // For example, the time of the last select() call. | 660 // For example, the time of the last select() call. |
690 // If unknown, this value will be set to zero. | 661 // If unknown, this value will be set to zero. |
691 }; | 662 }; |
692 | 663 |
693 // Minimum and maximum playout delay values from capture to render. | 664 // Minimum and maximum playout delay values from capture to render. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 uint8_t numCSRCs; | 715 uint8_t numCSRCs; |
745 uint32_t arrOfCSRCs[kRtpCsrcSize]; | 716 uint32_t arrOfCSRCs[kRtpCsrcSize]; |
746 size_t paddingLength; | 717 size_t paddingLength; |
747 size_t headerLength; | 718 size_t headerLength; |
748 int payload_type_frequency; | 719 int payload_type_frequency; |
749 RTPHeaderExtension extension; | 720 RTPHeaderExtension extension; |
750 }; | 721 }; |
751 | 722 |
752 struct RtpPacketCounter { | 723 struct RtpPacketCounter { |
753 RtpPacketCounter() | 724 RtpPacketCounter() |
754 : header_bytes(0), | 725 : header_bytes(0), payload_bytes(0), padding_bytes(0), packets(0) {} |
755 payload_bytes(0), | |
756 padding_bytes(0), | |
757 packets(0) {} | |
758 | 726 |
759 void Add(const RtpPacketCounter& other) { | 727 void Add(const RtpPacketCounter& other) { |
760 header_bytes += other.header_bytes; | 728 header_bytes += other.header_bytes; |
761 payload_bytes += other.payload_bytes; | 729 payload_bytes += other.payload_bytes; |
762 padding_bytes += other.padding_bytes; | 730 padding_bytes += other.padding_bytes; |
763 packets += other.packets; | 731 packets += other.packets; |
764 } | 732 } |
765 | 733 |
766 void Subtract(const RtpPacketCounter& other) { | 734 void Subtract(const RtpPacketCounter& other) { |
767 assert(header_bytes >= other.header_bytes); | 735 assert(header_bytes >= other.header_bytes); |
(...skipping 26 matching lines...) Expand all Loading... |
794 | 762 |
795 // Data usage statistics for a (rtp) stream. | 763 // Data usage statistics for a (rtp) stream. |
796 struct StreamDataCounters { | 764 struct StreamDataCounters { |
797 StreamDataCounters(); | 765 StreamDataCounters(); |
798 | 766 |
799 void Add(const StreamDataCounters& other) { | 767 void Add(const StreamDataCounters& other) { |
800 transmitted.Add(other.transmitted); | 768 transmitted.Add(other.transmitted); |
801 retransmitted.Add(other.retransmitted); | 769 retransmitted.Add(other.retransmitted); |
802 fec.Add(other.fec); | 770 fec.Add(other.fec); |
803 if (other.first_packet_time_ms != -1 && | 771 if (other.first_packet_time_ms != -1 && |
804 (other.first_packet_time_ms < first_packet_time_ms || | 772 (other.first_packet_time_ms < first_packet_time_ms || |
805 first_packet_time_ms == -1)) { | 773 first_packet_time_ms == -1)) { |
806 // Use oldest time. | 774 // Use oldest time. |
807 first_packet_time_ms = other.first_packet_time_ms; | 775 first_packet_time_ms = other.first_packet_time_ms; |
808 } | 776 } |
809 } | 777 } |
810 | 778 |
811 void Subtract(const StreamDataCounters& other) { | 779 void Subtract(const StreamDataCounters& other) { |
812 transmitted.Subtract(other.transmitted); | 780 transmitted.Subtract(other.transmitted); |
813 retransmitted.Subtract(other.retransmitted); | 781 retransmitted.Subtract(other.retransmitted); |
814 fec.Subtract(other.fec); | 782 fec.Subtract(other.fec); |
815 if (other.first_packet_time_ms != -1 && | 783 if (other.first_packet_time_ms != -1 && |
816 (other.first_packet_time_ms > first_packet_time_ms || | 784 (other.first_packet_time_ms > first_packet_time_ms || |
817 first_packet_time_ms == -1)) { | 785 first_packet_time_ms == -1)) { |
818 // Use youngest time. | 786 // Use youngest time. |
819 first_packet_time_ms = other.first_packet_time_ms; | 787 first_packet_time_ms = other.first_packet_time_ms; |
820 } | 788 } |
821 } | 789 } |
822 | 790 |
823 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { | 791 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { |
824 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); | 792 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); |
825 } | 793 } |
826 | 794 |
827 // Returns the number of bytes corresponding to the actual media payload (i.e. | 795 // Returns the number of bytes corresponding to the actual media payload (i.e. |
828 // RTP headers, padding, retransmissions and fec packets are excluded). | 796 // RTP headers, padding, retransmissions and fec packets are excluded). |
829 // Note this function does not have meaning for an RTX stream. | 797 // Note this function does not have meaning for an RTX stream. |
830 size_t MediaPayloadBytes() const { | 798 size_t MediaPayloadBytes() const { |
831 return transmitted.payload_bytes - retransmitted.payload_bytes - | 799 return transmitted.payload_bytes - retransmitted.payload_bytes - |
832 fec.payload_bytes; | 800 fec.payload_bytes; |
833 } | 801 } |
834 | 802 |
835 int64_t first_packet_time_ms; // Time when first packet is sent/received. | 803 int64_t first_packet_time_ms; // Time when first packet is sent/received. |
836 RtpPacketCounter transmitted; // Number of transmitted packets/bytes. | 804 RtpPacketCounter transmitted; // Number of transmitted packets/bytes. |
837 RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes. | 805 RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes. |
838 RtpPacketCounter fec; // Number of redundancy packets/bytes. | 806 RtpPacketCounter fec; // Number of redundancy packets/bytes. |
839 }; | 807 }; |
840 | 808 |
841 // Callback, called whenever byte/packet counts have been updated. | 809 // Callback, called whenever byte/packet counts have been updated. |
842 class StreamDataCountersCallback { | 810 class StreamDataCountersCallback { |
843 public: | 811 public: |
844 virtual ~StreamDataCountersCallback() {} | 812 virtual ~StreamDataCountersCallback() {} |
845 | 813 |
846 virtual void DataCountersUpdated(const StreamDataCounters& counters, | 814 virtual void DataCountersUpdated(const StreamDataCounters& counters, |
847 uint32_t ssrc) = 0; | 815 uint32_t ssrc) = 0; |
848 }; | 816 }; |
849 | 817 |
850 // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size | 818 // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size |
851 // RTCP mode is described by RFC 5506. | 819 // RTCP mode is described by RFC 5506. |
852 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 820 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
853 | 821 |
854 enum NetworkState { | 822 enum NetworkState { |
855 kNetworkUp, | 823 kNetworkUp, |
856 kNetworkDown, | 824 kNetworkDown, |
857 }; | 825 }; |
858 | 826 |
859 } // namespace webrtc | 827 } // namespace webrtc |
860 | 828 |
861 #endif // WEBRTC_COMMON_TYPES_H_ | 829 #endif // WEBRTC_COMMON_TYPES_H_ |
OLD | NEW |