xref: /aosp_15_r20/external/webrtc/modules/rtp_rtcp/source/rtp_header_extension_size.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2018 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 #ifndef MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_SIZE_H_
11 #define MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_SIZE_H_
12 
13 #include "api/array_view.h"
14 #include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
15 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
16 
17 namespace webrtc {
18 
19 struct RtpExtensionSize {
20   RTPExtensionType type;
21   int value_size;
22 };
23 
24 // Calculates rtp header extension size in bytes assuming packet contain
25 // all `extensions` with provided `value_size`.
26 // Counts only extensions present among `registered_extensions`.
27 int RtpHeaderExtensionSize(rtc::ArrayView<const RtpExtensionSize> extensions,
28                            const RtpHeaderExtensionMap& registered_extensions);
29 
30 }  // namespace webrtc
31 
32 #endif  // MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_SIZE_H_
33