niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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_SOURCE_RTP_UTILITY_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ |
| 13 | |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 14 | #include <map> |
| 15 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 16 | #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
Danil Chapovalov | 07633bd | 2017-06-01 17:10:51 +0200 | [diff] [blame] | 17 | #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 18 | #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 19 | #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 20 | #include "webrtc/rtc_base/deprecation.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 21 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 25 | const uint8_t kRtpMarkerBitMask = 0x80; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 26 | |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 27 | RtpFeedback* NullObjectRtpFeedback(); |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 28 | |
pbos@webrtc.org | 62bafae | 2014-07-08 12:10:51 +0000 | [diff] [blame] | 29 | namespace RtpUtility { |
pwestin@webrtc.org | 0644b1d | 2011-12-01 15:42:31 +0000 | [diff] [blame] | 30 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 31 | struct Payload { |
| 32 | char name[RTP_PAYLOAD_NAME_SIZE]; |
| 33 | bool audio; |
| 34 | PayloadUnion typeSpecific; |
| 35 | }; |
pwestin@webrtc.org | 0644b1d | 2011-12-01 15:42:31 +0000 | [diff] [blame] | 36 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 37 | bool StringCompare(const char* str1, const char* str2, const uint32_t length); |
phoglund@webrtc.org | 07bf43c | 2012-12-18 15:40:53 +0000 | [diff] [blame] | 38 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 39 | // Round up to the nearest size that is a multiple of 4. |
| 40 | size_t Word32Align(size_t size); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 42 | class RtpHeaderParser { |
| 43 | public: |
| 44 | RtpHeaderParser(const uint8_t* rtpData, size_t rtpDataLength); |
| 45 | ~RtpHeaderParser(); |
marpan@webrtc.org | 57353a3 | 2011-12-16 17:21:09 +0000 | [diff] [blame] | 46 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 47 | bool RTCP() const; |
| 48 | bool ParseRtcp(RTPHeader* header) const; |
| 49 | bool Parse(RTPHeader* parsedPacket, |
| 50 | RtpHeaderExtensionMap* ptrExtensionMap = nullptr) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 52 | private: |
| 53 | void ParseOneByteExtensionHeader(RTPHeader* parsedPacket, |
| 54 | const RtpHeaderExtensionMap* ptrExtensionMap, |
| 55 | const uint8_t* ptrRTPDataExtensionEnd, |
| 56 | const uint8_t* ptr) const; |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 57 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 58 | const uint8_t* const _ptrRTPDataBegin; |
| 59 | const uint8_t* const _ptrRTPDataEnd; |
| 60 | }; |
stefan@webrtc.org | 5a098c5 | 2014-09-17 11:58:20 +0000 | [diff] [blame] | 61 | } // namespace RtpUtility |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 62 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 64 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ |