?? hust_rtcpheader.c
字號:
/*------------------------------------------------------------------------- * rtcpheader.c - rtcpheader *------------------------------------------------------------------------- */#include <ipOS.h>#include <ipHAL.h>#include <ipStack.h>#include <ipEthernet.h>#include "hust_rtp.h"#include "hust_rtplibcommon.h"#include "hust_rtcp.h"#include "hust_event.h"#include "hust_hash.h"///#include <rtp.h>///#include <rtcp.h>/*------------------------------------------------------------------------ * rtcpheader - fill in an RTCP header in machine byte order and pad * for 32-bit alignment if necessary. Rtcpheader assumes that the caller * has allocated the correct amount of memory to round up so that the * message is 32-bit aligned. *------------------------------------------------------------------------ */intrtcpheader(struct rtcp *prtcp, int count, unsigned char type, u32_t bytelength){ u8_t pad, i; if (count > (1 << 5) - 1) return ERROR; if (bytelength > 1 << 18) return ERROR; prtcp->rtcp_ver = RTP_CURRVERS; prtcp->rtcp_count = count; prtcp->rtcp_type = type; /* * RTCP acket length represented in 4-octet units minus one. */ prtcp->rtcp_length = (bytelength / 4) - 1; /* * Determine if the packet must be padded so that it is * 32-bit aligned. */ pad = (bytelength % 4 > 0 ? 4 - (bytelength % 4) : 0); if (pad > 0) { prtcp->rtcp_length++; prtcp->rtcp_pad = TRUE; for (i = 0; i < pad - 1; i++) { *((char *) prtcp + bytelength + i) = 0; } /* * The last byte of a padded RTCP packet * indicates the number of padding bytes * present. */ *((char *) prtcp + bytelength + pad - 1) = pad; } else prtcp->rtcp_pad = FALSE; return OK;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -