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_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ |
13 | 13 |
14 #include <stddef.h> // size_t, ptrdiff_t | 14 #include <stddef.h> // size_t, ptrdiff_t |
15 | 15 |
16 #include "webrtc/base/scoped_ptr.h" | |
17 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" | 16 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
18 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
19 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
20 | 19 |
21 namespace webrtc { | 20 namespace webrtc { |
22 namespace rtcp { | |
23 class RtcpPacket; | |
24 } | |
25 namespace RTCPUtility { | 21 namespace RTCPUtility { |
26 | 22 |
27 class NackStats { | 23 class NackStats { |
28 public: | 24 public: |
29 NackStats(); | 25 NackStats(); |
30 ~NackStats(); | 26 ~NackStats(); |
31 | 27 |
32 // Updates stats with requested sequence number. | 28 // Updates stats with requested sequence number. |
33 // This function should be called for each NACK request to calculate the | 29 // This function should be called for each NACK request to calculate the |
34 // number of unique NACKed RTP packets. | 30 // number of unique NACKed RTP packets. |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 287 |
292 // RFC 3611 | 288 // RFC 3611 |
293 kXrHeader, | 289 kXrHeader, |
294 kXrReceiverReferenceTime, | 290 kXrReceiverReferenceTime, |
295 kXrDlrrReportBlock, | 291 kXrDlrrReportBlock, |
296 kXrDlrrReportBlockItem, | 292 kXrDlrrReportBlockItem, |
297 kXrVoipMetric, | 293 kXrVoipMetric, |
298 | 294 |
299 kApp, | 295 kApp, |
300 kAppItem, | 296 kAppItem, |
301 | |
302 // draft-holmer-rmcat-transport-wide-cc-extensions | |
303 kTransportFeedback, | |
304 }; | 297 }; |
305 | 298 |
306 struct RTCPRawPacket { | 299 struct RTCPRawPacket { |
307 const uint8_t* _ptrPacketBegin; | 300 const uint8_t* _ptrPacketBegin; |
308 const uint8_t* _ptrPacketEnd; | 301 const uint8_t* _ptrPacketEnd; |
309 }; | 302 }; |
310 | 303 |
311 struct RTCPModRawPacket { | 304 struct RTCPModRawPacket { |
312 uint8_t* _ptrPacketBegin; | 305 uint8_t* _ptrPacketBegin; |
313 uint8_t* _ptrPacketEnd; | 306 uint8_t* _ptrPacketEnd; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 class RTCPParserV2 { | 352 class RTCPParserV2 { |
360 public: | 353 public: |
361 RTCPParserV2( | 354 RTCPParserV2( |
362 const uint8_t* rtcpData, | 355 const uint8_t* rtcpData, |
363 size_t rtcpDataLength, | 356 size_t rtcpDataLength, |
364 bool rtcpReducedSizeEnable); // Set to true, to allow non-compound RTCP! | 357 bool rtcpReducedSizeEnable); // Set to true, to allow non-compound RTCP! |
365 ~RTCPParserV2(); | 358 ~RTCPParserV2(); |
366 | 359 |
367 RTCPPacketTypes PacketType() const; | 360 RTCPPacketTypes PacketType() const; |
368 const RTCPPacket& Packet() const; | 361 const RTCPPacket& Packet() const; |
369 rtcp::RtcpPacket* ReleaseRtcpPacket(); | |
370 const RTCPRawPacket& RawPacket() const; | 362 const RTCPRawPacket& RawPacket() const; |
371 ptrdiff_t LengthLeft() const; | 363 ptrdiff_t LengthLeft() const; |
372 | 364 |
373 bool IsValid() const; | 365 bool IsValid() const; |
374 size_t NumSkippedBlocks() const; | |
375 | 366 |
376 RTCPPacketTypes Begin(); | 367 RTCPPacketTypes Begin(); |
377 RTCPPacketTypes Iterate(); | 368 RTCPPacketTypes Iterate(); |
378 | 369 |
379 private: | 370 private: |
380 enum class ParseState { | 371 enum class ParseState { |
381 State_TopLevel, // Top level packet | 372 State_TopLevel, // Top level packet |
382 State_ReportBlockItem, // SR/RR report block | 373 State_ReportBlockItem, // SR/RR report block |
383 State_SDESChunk, // SDES chunk | 374 State_SDESChunk, // SDES chunk |
384 State_BYEItem, // BYE item | 375 State_BYEItem, // BYE item |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 const uint8_t* const _ptrRTCPDataBegin; | 447 const uint8_t* const _ptrRTCPDataBegin; |
457 const bool _RTCPReducedSizeEnable; | 448 const bool _RTCPReducedSizeEnable; |
458 const uint8_t* const _ptrRTCPDataEnd; | 449 const uint8_t* const _ptrRTCPDataEnd; |
459 | 450 |
460 bool _validPacket; | 451 bool _validPacket; |
461 const uint8_t* _ptrRTCPData; | 452 const uint8_t* _ptrRTCPData; |
462 const uint8_t* _ptrRTCPBlockEnd; | 453 const uint8_t* _ptrRTCPBlockEnd; |
463 | 454 |
464 ParseState _state; | 455 ParseState _state; |
465 uint8_t _numberOfBlocks; | 456 uint8_t _numberOfBlocks; |
466 size_t num_skipped_blocks_; | |
467 | 457 |
468 RTCPPacketTypes _packetType; | 458 RTCPPacketTypes _packetType; |
469 RTCPPacket _packet; | 459 RTCPPacket _packet; |
470 rtc::scoped_ptr<webrtc::rtcp::RtcpPacket> rtcp_packet_; | |
471 }; | 460 }; |
472 | 461 |
473 class RTCPPacketIterator { | 462 class RTCPPacketIterator { |
474 public: | 463 public: |
475 RTCPPacketIterator(uint8_t* rtcpData, size_t rtcpDataLength); | 464 RTCPPacketIterator(uint8_t* rtcpData, size_t rtcpDataLength); |
476 ~RTCPPacketIterator(); | 465 ~RTCPPacketIterator(); |
477 | 466 |
478 const RtcpCommonHeader* Begin(); | 467 const RtcpCommonHeader* Begin(); |
479 const RtcpCommonHeader* Iterate(); | 468 const RtcpCommonHeader* Iterate(); |
480 const RtcpCommonHeader* Current(); | 469 const RtcpCommonHeader* Current(); |
481 | 470 |
482 private: | 471 private: |
483 uint8_t* const _ptrBegin; | 472 uint8_t* const _ptrBegin; |
484 uint8_t* const _ptrEnd; | 473 uint8_t* const _ptrEnd; |
485 | 474 |
486 uint8_t* _ptrBlock; | 475 uint8_t* _ptrBlock; |
487 | 476 |
488 RtcpCommonHeader _header; | 477 RtcpCommonHeader _header; |
489 }; | 478 }; |
490 } // RTCPUtility | 479 } // RTCPUtility |
491 } // namespace webrtc | 480 } // namespace webrtc |
492 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ | 481 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ |
OLD | NEW |