📄 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 + -