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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ |
| 12 | #define MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 14 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
Niels Möller | f418bcb | 2018-11-05 13:27:35 +0100 | [diff] [blame] | 16 | #include <algorithm> |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 17 | |
Danil Chapovalov | 00ca004 | 2021-07-05 19:06:17 +0200 | [diff] [blame] | 18 | #include "absl/base/attributes.h" |
Niels Möller | f418bcb | 2018-11-05 13:27:35 +0100 | [diff] [blame] | 19 | #include "absl/strings/string_view.h" |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 20 | #include "api/rtp_headers.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" |
| 22 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
| 24 | namespace webrtc { |
pbos@webrtc.org | 62bafae | 2014-07-08 12:10:51 +0000 | [diff] [blame] | 25 | namespace RtpUtility { |
pwestin@webrtc.org | 0644b1d | 2011-12-01 15:42:31 +0000 | [diff] [blame] | 26 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 27 | class RtpHeaderParser { |
| 28 | public: |
| 29 | RtpHeaderParser(const uint8_t* rtpData, size_t rtpDataLength); |
| 30 | ~RtpHeaderParser(); |
marpan@webrtc.org | 57353a3 | 2011-12-16 17:21:09 +0000 | [diff] [blame] | 31 | |
Danil Chapovalov | 00ca004 | 2021-07-05 19:06:17 +0200 | [diff] [blame] | 32 | ABSL_DEPRECATED("Use IsRtpPacket or IsRtcpPacket") |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 33 | bool RTCP() const; |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 34 | bool Parse(RTPHeader* parsedPacket, |
Sebastian Jansson | 62c7b39 | 2019-03-08 13:45:29 +0100 | [diff] [blame] | 35 | const RtpHeaderExtensionMap* ptrExtensionMap = nullptr, |
| 36 | bool header_only = false) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 38 | private: |
| 39 | void ParseOneByteExtensionHeader(RTPHeader* parsedPacket, |
| 40 | const RtpHeaderExtensionMap* ptrExtensionMap, |
| 41 | const uint8_t* ptrRTPDataExtensionEnd, |
| 42 | const uint8_t* ptr) const; |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 43 | |
danilchap | f6975f4 | 2015-12-28 10:18:46 -0800 | [diff] [blame] | 44 | const uint8_t* const _ptrRTPDataBegin; |
| 45 | const uint8_t* const _ptrRTPDataEnd; |
| 46 | }; |
stefan@webrtc.org | 5a098c5 | 2014-09-17 11:58:20 +0000 | [diff] [blame] | 47 | } // namespace RtpUtility |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 48 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 50 | #endif // MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ |