blob: 694cf2c02227cb3fdf43345a373b38f02eaf0b0d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_
12#define MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020015
Niels Möllerf418bcb2018-11-05 13:27:35 +010016#include <algorithm>
danilchapb8b6fbb2015-12-10 05:05:27 -080017
Danil Chapovalov00ca0042021-07-05 19:06:17 +020018#include "absl/base/attributes.h"
Niels Möllerf418bcb2018-11-05 13:27:35 +010019#include "absl/strings/string_view.h"
Yves Gerey988cc082018-10-23 12:03:01 +020020#include "api/rtp_headers.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
22#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
24namespace webrtc {
pbos@webrtc.org62bafae2014-07-08 12:10:51 +000025namespace RtpUtility {
pwestin@webrtc.org0644b1d2011-12-01 15:42:31 +000026
danilchapf6975f42015-12-28 10:18:46 -080027class RtpHeaderParser {
28 public:
29 RtpHeaderParser(const uint8_t* rtpData, size_t rtpDataLength);
30 ~RtpHeaderParser();
marpan@webrtc.org57353a32011-12-16 17:21:09 +000031
Danil Chapovalov00ca0042021-07-05 19:06:17 +020032 ABSL_DEPRECATED("Use IsRtpPacket or IsRtcpPacket")
danilchapf6975f42015-12-28 10:18:46 -080033 bool RTCP() const;
danilchapf6975f42015-12-28 10:18:46 -080034 bool Parse(RTPHeader* parsedPacket,
Sebastian Jansson62c7b392019-03-08 13:45:29 +010035 const RtpHeaderExtensionMap* ptrExtensionMap = nullptr,
36 bool header_only = false) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000037
danilchapf6975f42015-12-28 10:18:46 -080038 private:
39 void ParseOneByteExtensionHeader(RTPHeader* parsedPacket,
40 const RtpHeaderExtensionMap* ptrExtensionMap,
41 const uint8_t* ptrRTPDataExtensionEnd,
42 const uint8_t* ptr) const;
sprang@webrtc.org30933902015-03-17 14:33:12 +000043
danilchapf6975f42015-12-28 10:18:46 -080044 const uint8_t* const _ptrRTPDataBegin;
45 const uint8_t* const _ptrRTPDataEnd;
46};
stefan@webrtc.org5a098c52014-09-17 11:58:20 +000047} // namespace RtpUtility
henrike@webrtc.orgd5657c22012-02-08 23:41:49 +000048} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000049
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020050#endif // MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_