Changeset 5460
- Timestamp:
- Oct 13, 2016 11:49:57 AM (8 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/rtp.h
r3553 r5460 114 114 115 115 /** 116 * RTP exten dsion header.116 * RTP extension header. 117 117 */ 118 118 struct pjmedia_rtp_ext_hdr … … 127 127 typedef struct pjmedia_rtp_ext_hdr pjmedia_rtp_ext_hdr; 128 128 129 /** 130 * This will contain the RTP header decode output. 131 */ 132 struct pjmedia_rtp_dec_hdr 133 { 134 /* RTP extension header output decode */ 135 pjmedia_rtp_ext_hdr *ext_hdr; 136 pj_uint32_t *ext; 137 unsigned ext_len; 138 }; 139 140 /** 141 * @see pjmedia_rtp_dec_hdr 142 */ 143 typedef struct pjmedia_rtp_dec_hdr pjmedia_rtp_dec_hdr; 129 144 130 145 #pragma pack(1) … … 322 337 unsigned *payloadlen); 323 338 339 340 /** 341 * This function decodes incoming packet into RTP header and payload. 342 * The decode function is guaranteed to point the payload to the correct 343 * position regardless of any options present in the RTP packet. 344 * 345 * Note that this function does not modify the returned RTP header to 346 * host byte order. 347 * 348 * @param ses The session. 349 * @param pkt The received RTP packet. 350 * @param pkt_len The length of the packet. 351 * @param hdr Upon return will point to the location of the RTP 352 * header inside the packet. Note that the RTP header 353 * will be given back as is, meaning that the fields 354 * will be in network byte order. 355 * @param dec_hdr Upon return will point to the location of the 356 * additional RTP header inside the packet, if any. 357 * @param payload Upon return will point to the location of the 358 * payload inside the packet. 359 * @param payloadlen Upon return will indicate the size of the payload. 360 * 361 * @return PJ_SUCCESS if successfull. 362 */ 363 PJ_DECL(pj_status_t) pjmedia_rtp_decode_rtp2( 364 pjmedia_rtp_session *ses, 365 const void *pkt, int pkt_len, 366 const pjmedia_rtp_hdr **hdr, 367 pjmedia_rtp_dec_hdr *dec_hdr, 368 const void **payload, 369 unsigned *payloadlen); 370 324 371 /** 325 372 * Call this function everytime an RTP packet is received to check whether -
pjproject/trunk/pjmedia/src/pjmedia/rtp.c
r4235 r5460 150 150 unsigned *payloadlen) 151 151 { 152 pjmedia_rtp_dec_hdr dec_hdr; 153 154 return pjmedia_rtp_decode_rtp2(ses, pkt, pkt_len, hdr, &dec_hdr, 155 payload, payloadlen); 156 } 157 158 159 PJ_DEF(pj_status_t) pjmedia_rtp_decode_rtp2( 160 pjmedia_rtp_session *ses, 161 const void *pkt, int pkt_len, 162 const pjmedia_rtp_hdr **hdr, 163 pjmedia_rtp_dec_hdr *dec_hdr, 164 const void **payload, 165 unsigned *payloadlen) 166 { 152 167 int offset; 153 168 … … 165 180 offset = sizeof(pjmedia_rtp_hdr) + ((*hdr)->cc * sizeof(pj_uint32_t)); 166 181 167 /* Adjust offset if RTP extension is used. */182 /* Decode RTP extension. */ 168 183 if ((*hdr)->x) { 169 pjmedia_rtp_ext_hdr *ext = (pjmedia_rtp_ext_hdr*) 170 (((pj_uint8_t*)pkt) + offset); 171 offset += ((pj_ntohs(ext->length)+1) * sizeof(pj_uint32_t)); 184 dec_hdr->ext_hdr = (pjmedia_rtp_ext_hdr*)(((pj_uint8_t*)pkt) + offset); 185 dec_hdr->ext = (pj_uint32_t*)(dec_hdr->ext_hdr + 1); 186 dec_hdr->ext_len = pj_ntohs((dec_hdr->ext_hdr)->length); 187 offset += ((dec_hdr->ext_len + 1) * sizeof(pj_uint32_t)); 188 } else { 189 dec_hdr->ext_hdr = NULL; 190 dec_hdr->ext = NULL; 191 dec_hdr->ext_len = 0; 172 192 } 173 193
Note: See TracChangeset
for help on using the changeset viewer.