Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h

Issue 1414793020: Remove interface directories kept to avoid breaking downstream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_
12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_
13
14 #pragma message("WARNING: rtp_rtcp/interface is DEPRECATED; use include dir.")
15
16 #include <stddef.h>
17 #include <list>
18
19 #include "webrtc/modules/include/module_common_types.h"
20 #include "webrtc/system_wrappers/include/clock.h"
21 #include "webrtc/typedefs.h"
22
23 #define RTCP_CNAME_SIZE 256 // RFC 3550 page 44, including null termination
24 #define IP_PACKET_SIZE 1500 // we assume ethernet
25 #define MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS 10
26 #define TIMEOUT_SEI_MESSAGES_MS 30000 // in milliseconds
27
28 namespace webrtc {
29 namespace rtcp {
30 class TransportFeedback;
31 }
32
33 const int kVideoPayloadTypeFrequency = 90000;
34
35 // Minimum RTP header size in bytes.
36 const uint8_t kRtpHeaderSize = 12;
37
38 struct AudioPayload
39 {
40 uint32_t frequency;
41 uint8_t channels;
42 uint32_t rate;
43 };
44
45 struct VideoPayload
46 {
47 RtpVideoCodecTypes videoCodecType;
48 uint32_t maxRate;
49 };
50
51 union PayloadUnion
52 {
53 AudioPayload Audio;
54 VideoPayload Video;
55 };
56
57 enum RTPAliveType
58 {
59 kRtpDead = 0,
60 kRtpNoRtp = 1,
61 kRtpAlive = 2
62 };
63
64 enum ProtectionType {
65 kUnprotectedPacket,
66 kProtectedPacket
67 };
68
69 enum StorageType {
70 kDontRetransmit,
71 kAllowRetransmission
72 };
73
74 enum RTPExtensionType {
75 kRtpExtensionNone,
76 kRtpExtensionTransmissionTimeOffset,
77 kRtpExtensionAudioLevel,
78 kRtpExtensionAbsoluteSendTime,
79 kRtpExtensionVideoRotation,
80 kRtpExtensionTransportSequenceNumber,
81 };
82
83 enum RTCPAppSubTypes
84 {
85 kAppSubtypeBwe = 0x00
86 };
87
88 // TODO(sprang): Make this an enum class once rtcp_receiver has been cleaned up.
89 enum RTCPPacketType : uint32_t {
90 kRtcpReport = 0x0001,
91 kRtcpSr = 0x0002,
92 kRtcpRr = 0x0004,
93 kRtcpSdes = 0x0008,
94 kRtcpBye = 0x0010,
95 kRtcpPli = 0x0020,
96 kRtcpNack = 0x0040,
97 kRtcpFir = 0x0080,
98 kRtcpTmmbr = 0x0100,
99 kRtcpTmmbn = 0x0200,
100 kRtcpSrReq = 0x0400,
101 kRtcpXrVoipMetric = 0x0800,
102 kRtcpApp = 0x1000,
103 kRtcpSli = 0x4000,
104 kRtcpRpsi = 0x8000,
105 kRtcpRemb = 0x10000,
106 kRtcpTransmissionTimeOffset = 0x20000,
107 kRtcpXrReceiverReferenceTime = 0x40000,
108 kRtcpXrDlrrReportBlock = 0x80000,
109 kRtcpTransportFeedback = 0x100000,
110 };
111
112 enum KeyFrameRequestMethod { kKeyFrameReqPliRtcp, kKeyFrameReqFirRtcp };
113
114 enum RtpRtcpPacketType
115 {
116 kPacketRtp = 0,
117 kPacketKeepAlive = 1
118 };
119
120 enum NACKMethod
121 {
122 kNackOff = 0,
123 kNackRtcp = 2
124 };
125
126 enum RetransmissionMode : uint8_t {
127 kRetransmitOff = 0x0,
128 kRetransmitFECPackets = 0x1,
129 kRetransmitBaseLayer = 0x2,
130 kRetransmitHigherLayers = 0x4,
131 kRetransmitAllPackets = 0xFF
132 };
133
134 enum RtxMode {
135 kRtxOff = 0x0,
136 kRtxRetransmitted = 0x1, // Only send retransmissions over RTX.
137 kRtxRedundantPayloads = 0x2 // Preventively send redundant payloads
138 // instead of padding.
139 };
140
141 const size_t kRtxHeaderSize = 2;
142
143 struct RTCPSenderInfo
144 {
145 uint32_t NTPseconds;
146 uint32_t NTPfraction;
147 uint32_t RTPtimeStamp;
148 uint32_t sendPacketCount;
149 uint32_t sendOctetCount;
150 };
151
152 struct RTCPReportBlock {
153 RTCPReportBlock()
154 : remoteSSRC(0), sourceSSRC(0), fractionLost(0), cumulativeLost(0),
155 extendedHighSeqNum(0), jitter(0), lastSR(0),
156 delaySinceLastSR(0) {}
157
158 RTCPReportBlock(uint32_t remote_ssrc,
159 uint32_t source_ssrc,
160 uint8_t fraction_lost,
161 uint32_t cumulative_lost,
162 uint32_t extended_high_sequence_number,
163 uint32_t jitter,
164 uint32_t last_sender_report,
165 uint32_t delay_since_last_sender_report)
166 : remoteSSRC(remote_ssrc),
167 sourceSSRC(source_ssrc),
168 fractionLost(fraction_lost),
169 cumulativeLost(cumulative_lost),
170 extendedHighSeqNum(extended_high_sequence_number),
171 jitter(jitter),
172 lastSR(last_sender_report),
173 delaySinceLastSR(delay_since_last_sender_report) {}
174
175 // Fields as described by RFC 3550 6.4.2.
176 uint32_t remoteSSRC; // SSRC of sender of this report.
177 uint32_t sourceSSRC; // SSRC of the RTP packet sender.
178 uint8_t fractionLost;
179 uint32_t cumulativeLost; // 24 bits valid.
180 uint32_t extendedHighSeqNum;
181 uint32_t jitter;
182 uint32_t lastSR;
183 uint32_t delaySinceLastSR;
184 };
185
186 struct RtcpReceiveTimeInfo {
187 // Fields as described by RFC 3611 4.5.
188 uint32_t sourceSSRC;
189 uint32_t lastRR;
190 uint32_t delaySinceLastRR;
191 };
192
193 typedef std::list<RTCPReportBlock> ReportBlockList;
194
195 struct RtpState {
196 RtpState()
197 : sequence_number(0),
198 start_timestamp(0),
199 timestamp(0),
200 capture_time_ms(-1),
201 last_timestamp_time_ms(-1),
202 media_has_been_sent(false) {}
203 uint16_t sequence_number;
204 uint32_t start_timestamp;
205 uint32_t timestamp;
206 int64_t capture_time_ms;
207 int64_t last_timestamp_time_ms;
208 bool media_has_been_sent;
209 };
210
211 class RtpData
212 {
213 public:
214 virtual ~RtpData() {}
215
216 virtual int32_t OnReceivedPayloadData(
217 const uint8_t* payloadData,
218 const size_t payloadSize,
219 const WebRtcRTPHeader* rtpHeader) = 0;
220
221 virtual bool OnRecoveredPacket(const uint8_t* packet,
222 size_t packet_length) = 0;
223 };
224
225 class RtpFeedback
226 {
227 public:
228 virtual ~RtpFeedback() {}
229
230 // Receiving payload change or SSRC change. (return success!)
231 /*
232 * channels - number of channels in codec (1 = mono, 2 = stereo)
233 */
234 virtual int32_t OnInitializeDecoder(
235 const int8_t payloadType,
236 const char payloadName[RTP_PAYLOAD_NAME_SIZE],
237 const int frequency,
238 const uint8_t channels,
239 const uint32_t rate) = 0;
240
241 virtual void OnIncomingSSRCChanged(const uint32_t ssrc) = 0;
242
243 virtual void OnIncomingCSRCChanged(const uint32_t CSRC,
244 const bool added) = 0;
245 };
246
247 class RtpAudioFeedback {
248 public:
249 virtual void OnPlayTelephoneEvent(const uint8_t event,
250 const uint16_t lengthMs,
251 const uint8_t volume) = 0;
252
253 protected:
254 virtual ~RtpAudioFeedback() {}
255 };
256
257 class RtcpIntraFrameObserver {
258 public:
259 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) = 0;
260
261 virtual void OnReceivedSLI(uint32_t ssrc,
262 uint8_t picture_id) = 0;
263
264 virtual void OnReceivedRPSI(uint32_t ssrc,
265 uint64_t picture_id) = 0;
266
267 virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) = 0;
268
269 virtual ~RtcpIntraFrameObserver() {}
270 };
271
272 class RtcpBandwidthObserver {
273 public:
274 // REMB or TMMBR
275 virtual void OnReceivedEstimatedBitrate(uint32_t bitrate) = 0;
276
277 virtual void OnReceivedRtcpReceiverReport(
278 const ReportBlockList& report_blocks,
279 int64_t rtt,
280 int64_t now_ms) = 0;
281
282 virtual ~RtcpBandwidthObserver() {}
283 };
284
285 struct PacketInfo {
286 PacketInfo(int64_t arrival_time_ms, uint16_t sequence_number)
287 : PacketInfo(-1, arrival_time_ms, -1, sequence_number, 0, false) {}
288
289 PacketInfo(int64_t arrival_time_ms,
290 int64_t send_time_ms,
291 uint16_t sequence_number,
292 size_t payload_size,
293 bool was_paced)
294 : PacketInfo(-1,
295 arrival_time_ms,
296 send_time_ms,
297 sequence_number,
298 payload_size,
299 was_paced) {}
300
301 PacketInfo(int64_t creation_time_ms,
302 int64_t arrival_time_ms,
303 int64_t send_time_ms,
304 uint16_t sequence_number,
305 size_t payload_size,
306 bool was_paced)
307 : creation_time_ms(creation_time_ms),
308 arrival_time_ms(arrival_time_ms),
309 send_time_ms(send_time_ms),
310 sequence_number(sequence_number),
311 payload_size(payload_size),
312 was_paced(was_paced) {}
313
314 // Time corresponding to when this object was created.
315 int64_t creation_time_ms;
316 // Time corresponding to when the packet was received. Timestamped with the
317 // receiver's clock.
318 int64_t arrival_time_ms;
319 // Time corresponding to when the packet was sent, timestamped with the
320 // sender's clock.
321 int64_t send_time_ms;
322 // Packet identifier, incremented with 1 for every packet generated by the
323 // sender.
324 uint16_t sequence_number;
325 // Size of the packet excluding RTP headers.
326 size_t payload_size;
327 // True if the packet was paced out by the pacer.
328 bool was_paced;
329 };
330
331 class TransportFeedbackObserver {
332 public:
333 TransportFeedbackObserver() {}
334 virtual ~TransportFeedbackObserver() {}
335
336 // Note: Transport-wide sequence number as sequence number. Arrival time
337 // must be set to 0.
338 virtual void AddPacket(uint16_t sequence_number,
339 size_t length,
340 bool was_paced) = 0;
341
342 virtual void OnTransportFeedback(const rtcp::TransportFeedback& feedback) = 0;
343 };
344
345 class RtcpRttStats {
346 public:
347 virtual void OnRttUpdate(int64_t rtt) = 0;
348
349 virtual int64_t LastProcessedRtt() const = 0;
350
351 virtual ~RtcpRttStats() {};
352 };
353
354 // Null object version of RtpFeedback.
355 class NullRtpFeedback : public RtpFeedback {
356 public:
357 virtual ~NullRtpFeedback() {}
358
359 int32_t OnInitializeDecoder(const int8_t payloadType,
360 const char payloadName[RTP_PAYLOAD_NAME_SIZE],
361 const int frequency,
362 const uint8_t channels,
363 const uint32_t rate) override {
364 return 0;
365 }
366
367 void OnIncomingSSRCChanged(const uint32_t ssrc) override {}
368 void OnIncomingCSRCChanged(const uint32_t CSRC, const bool added) override {}
369 };
370
371 // Null object version of RtpData.
372 class NullRtpData : public RtpData {
373 public:
374 virtual ~NullRtpData() {}
375
376 int32_t OnReceivedPayloadData(const uint8_t* payloadData,
377 const size_t payloadSize,
378 const WebRtcRTPHeader* rtpHeader) override {
379 return 0;
380 }
381
382 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override {
383 return true;
384 }
385 };
386
387 // Null object version of RtpAudioFeedback.
388 class NullRtpAudioFeedback : public RtpAudioFeedback {
389 public:
390 virtual ~NullRtpAudioFeedback() {}
391
392 void OnPlayTelephoneEvent(const uint8_t event,
393 const uint16_t lengthMs,
394 const uint8_t volume) override {}
395 };
396
397 // Statistics about packet loss for a single directional connection. All values
398 // are totals since the connection initiated.
399 struct RtpPacketLossStats {
400 // The number of packets lost in events where no adjacent packets were also
401 // lost.
402 uint64_t single_packet_loss_count;
403 // The number of events in which more than one adjacent packet was lost.
404 uint64_t multiple_packet_loss_event_count;
405 // The number of packets lost in events where more than one adjacent packet
406 // was lost.
407 uint64_t multiple_packet_loss_packet_count;
408 };
409
410 class RtpPacketSender {
411 public:
412 RtpPacketSender() {}
413 virtual ~RtpPacketSender() {}
414
415 enum Priority {
416 kHighPriority = 0, // Pass through; will be sent immediately.
417 kNormalPriority = 2, // Put in back of the line.
418 kLowPriority = 3, // Put in back of the low priority line.
419 };
420 // Low priority packets are mixed with the normal priority packets
421 // while we are paused.
422
423 // Returns true if we send the packet now, else it will add the packet
424 // information to the queue and call TimeToSendPacket when it's time to send.
425 virtual void InsertPacket(Priority priority,
426 uint32_t ssrc,
427 uint16_t sequence_number,
428 int64_t capture_time_ms,
429 size_t bytes,
430 bool retransmission) = 0;
431 };
432
433 class TransportSequenceNumberAllocator {
434 public:
435 TransportSequenceNumberAllocator() {}
436 virtual ~TransportSequenceNumberAllocator() {}
437
438 virtual uint16_t AllocateSequenceNumber() = 0;
439 };
440
441 } // namespace webrtc
442 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h ('k') | webrtc/modules/utility/interface/audio_frame_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698