1 2 /** \addtogroup RTP_Stack 3 * @{ 4 */ 5 6 /** 7 * @brief This file holds data structures, enums and constants of RTP Stack 8 */ 9 10 /** 11 * Copyright (C) 2022 The Android Open Source Project 12 * 13 * Licensed under the Apache License, Version 2.0 (the "License"); 14 * you may not use this file except in compliance with the License. 15 * You may obtain a copy of the License at 16 * 17 * http://www.apache.org/licenses/LICENSE-2.0 18 * 19 * Unless required by applicable law or agreed to in writing, software 20 * distributed under the License is distributed on an "AS IS" BASIS, 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the License for the specific language governing permissions and 23 * limitations under the License. 24 */ 25 26 #ifndef __RTP_GLOBAL_H__ 27 #define __RTP_GLOBAL_H__ 28 29 #include <RtpPfDatatypes.h> 30 #include <RtpOsUtil.h> 31 32 #define RTP_INIT_TRUE_T_MIN 2.5 33 #define RTP_INIT_FALSE_T_MIN 5 34 35 #define RTP_CONF_RTCP_BW_FRAC 5 36 #define RTP_CONF_RTCP_RPT_INTRL 25 37 #define RTP_CONF_BW_SPLIT 25 38 #define RTP_CONF_MTU_SIZE 3000 39 #define RTP_CONF_SSRC_SEED 2 40 41 #define RTP_SIXTEEN 16 42 #define RTP_EIGHT 8 43 #define RTP_FOUR 4 44 #define RTP_DEF_RTCP_BW_FRAC 5 45 46 #define RTP_DEF_RTCP_BW_SIZE 128 47 48 #define RTP_TWO_POWER_16 65536 49 #define RTP_SSRC_GEN_UTL 0xffffff00 50 #define RTP_DEF_MTU_SIZE 1350 51 #define MAX_RTCP_INACT_INTVL_CNT 5 52 #define RTP_MAX_SDES_TYPE 9 53 #define RTP_MAX_SDES_ITEMS 10 54 #define RTP_VERSION_NUM 2 55 56 #define RTP_BYTE2_BIT_SIZE 16 57 #define RTP_BYTE_BIT_SIZE 8 58 59 #define RTP_DEF_BYE_PKT_SIZE 8 60 #define RTP_DEF_BYE_REASON_SIZE 0 61 #define RTP_SDES_HDR_SIZE 4 62 #define RTP_DEF_APP_PKT_SIZE 12 63 #define RTP_DEF_REP_BLK_SIZE 24 64 #define RTP_DEF_SR_SPEC_SIZE 20 65 #define RTP_MAX_RECEP_REP_CNT 31 66 67 #define RTP_CVO_XHDR_LEN 8 68 69 #define RTCP_RC_SHIFT_VAL 8 // 12 70 #define RTCP_PT_SHIFT_VAL 0 // 7 71 #define RTCP_FIXED_HDR_LEN 8 72 73 #define RTP_MAX_PAYLOAD_TYPE 4 74 75 /* RTP error codes*/ 76 typedef enum 77 { 78 RTP_FAILURE = 0, 79 RTP_SUCCESS = 1, 80 RTP_MEMORY_FAIL = 2, 81 RTP_INVALID_PARAMS = 3, 82 RTP_OWN_SSRC_COLLISION = 4, 83 RTP_REMOTE_SSRC_COLLISION = 5, 84 RTP_MTU_EXCEEDED = 6, 85 RTP_NEW_SSRC_RCVD = 7, 86 RTP_OLD_SSRC_RCVD, 87 RTP_INVALID_LEN, 88 RTP_DECODE_ERROR, 89 RTP_ENCODE_ERROR, 90 RTP_BAD_SEQ, 91 RTCP_SR_MISSING, 92 RTCP_FLAG_NOT_ENABLED, 93 RTP_APP_IF_NOT_DEFINED, 94 RTP_RCVD_CSRC_ENTRY, 95 RTP_NO_RTCP_SUPPORT, 96 RTP_TIMER_PROC_ERR, 97 RTP_INVALID_MSG, 98 RTP_RTCP_ALREADY_RUNNING 99 } eRTP_STATUS_CODE; 100 101 /** 102 * The reason for member leave indication used in IRtpAppInterface::rtpMemberLeaveInd 103 */ 104 typedef enum 105 { 106 RTP_BYE_RECEIVED = 0, 107 RTP_PEER_SSRC_TIMEOUT = 1 108 } eRTP_LEAVE_REASON; 109 110 typedef enum 111 { 112 RTCP_SDES_END = 0, 113 RTCP_SDES_CNAME = 1, 114 RTCP_SDES_NAME = 2, 115 RTCP_SDES_EMAIL = 3, 116 RTCP_SDES_PHONE = 4, 117 RTCP_SDES_LOC = 5, 118 RTCP_SDES_TOOL = 6, 119 RTCP_SDES_NOTE = 7, 120 RTCP_SDES_PRIV = 8 121 } eRTCP_SDES_TYPE; 122 123 typedef enum 124 { 125 RTCP_SR = 200, 126 RTCP_RR = 201, 127 RTCP_SDES = 202, 128 RTCP_BYE = 203, 129 RTCP_APP = 204, 130 RTCP_RTPFB = 205, 131 RTCP_PSFB = 206, 132 RTCP_XR = 207 133 } eRTCP_TYPE; 134 135 // It is the source information for seq and jitter calculation 136 typedef struct 137 { 138 RtpDt_UInt16 usMaxSeq; /* highest seq. number seen */ 139 RtpDt_UInt32 uiCycles; /* shifted count of seq. number cycles */ 140 RtpDt_UInt32 uiBaseSeq; /* base seq number */ 141 RtpDt_UInt32 uiBadSeq; /* last 'bad' seq number + 1 */ 142 RtpDt_UInt32 uiProbation; /* sequ. packets till source is valid */ 143 RtpDt_UInt32 uiReceived; /* packets received */ 144 RtpDt_UInt32 uiExpectedPrior; /* packet expected at last interval */ 145 RtpDt_UInt32 uiReceivedPrior; /* packet received at last interval */ 146 RtpDt_Int32 uiTransit; /* relative trans time for prev pkt */ 147 RtpDt_Double uiJitter; /* estimated jitter */ 148 /* ... */ 149 } tRTP_SOURCE; 150 151 // It describes the Source Description Item 152 typedef struct 153 { 154 RtpDt_UChar ucType; 155 RtpDt_UChar ucLength; 156 RtpDt_UChar* pValue; 157 RtpDt_UInt32 uiFreq; 158 } tRTCP_SDES_ITEM; 159 160 // It describes the RTCP-XR Packet 161 typedef struct 162 { 163 RtpDt_UChar* m_pBlockBuffer; 164 RtpDt_UInt16 nlength; 165 } tRTCP_XR_DATA; 166 167 // RTP parser 168 #define RTP_WORD_SIZE 4 169 #define RTP_FIXED_HDR_LEN 12 170 #define RTCP_SR_PACKET_LENGTH 20 171 #define RTP_VER_SHIFT_VAL 14 172 #define RTP_PAD_SHIFT_VAL 13 173 #define RTP_EXT_SHIFT_VAL 12 174 #define RTP_CC_SHIFT_VAL 8 175 #define RTP_MARK_SHIFT_VAL 7 176 #define RTP_PLTYPE_SHIFT_VAL 0 177 #define RTP_HEX_1_BIT_MAX 0x0001 178 #define RTP_HEX_4_BIT_MAX 0x000F 179 #define RTP_HEX_7_BIT_MAX 0x007F 180 #define RTP_HEX_8_BIT_MAX 0x00FF 181 #define RTP_HEX_16_BIT_MAX 0xFFFF 182 #define RTP_HEX_24_BIT_MAX 0x007fffff 183 #define RTP_HEX_24_BIT_MIN 0xFF800000 184 185 #define RTP_FORM_HDR_UTL(_usUtlData, _actData, _shiftNum, _destData) \ 186 { \ 187 (_usUtlData) = (_actData); \ 188 (_usUtlData) = (_usUtlData) << (_shiftNum); \ 189 (_destData) = (_usUtlData) | (_destData); \ 190 (_usUtlData) = RTP_ZERO; \ 191 } 192 193 #endif //__RTP_GLOBAL_H__ 194 195 /** @}*/ 196