⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hust_rtcprecv.c

📁 实现基于ip2022的MPEG2 TS的IP组播接收
💻 C
字号:
/*------------------------------------------------------------------------- * rtcprecv.c - rtcprecv, processrtcp *------------------------------------------------------------------------- */#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 "hust_linux.h"///#include <hash.h>///#include <rtcp.h>///#include <rtp.h>///#include <stdlib.h>///#include <sys/types.h>///#include <sys/socket.h>///#include <unistd.h>/*------------------------------------------------------------------------ * rtcprecv - receive and process a (compound) RTCP packet *------------------------------------------------------------------------ *//*intrtcprecv(struct session *psn){	struct rtcp		*prtcp, *prtcp2;        u32_t	                from;	int			fromlen, len;	char			rtcpbuf[RTCP_MAXPACKETSZ];	prtcp = (struct rtcp *) rtcpbuf;	fromlen = sizeof(from);	len = recvfrom(psn->sn_rtcpfd, (char *) prtcp, RTCP_MAXPACKETSZ, 0, (struct sockaddr *) &from, &fromlen);	if (len < 0)		return ERROR;	*/	/*	 * Extract source address as RTCP destination for unicast session	 * if not already learned.	 */	/*if (psn->sn_rtcpto == INADDR_ANY)		psn->sn_rtcpto = from;*/	/*	 * Iterate over the compound packet. stop if we discover packet 	 * is truncated due to the use of fixed-sized buffers.	 */	/*	prtcp2 = prtcp;	while(len > RTCP_HEADERSZ) {		///prtcp2->rtcp_length = ntohs(prtcp2->rtcp_length);		if (len < RTCP_LENGTH_BYTE(prtcp2))			break;		rtcpprocess(psn, prtcp2);		len -= RTCP_LENGTH_BYTE(prtcp2);		prtcp2 = (struct rtcp *) ((char *) prtcp2 + RTCP_LENGTH_BYTE(prtcp2));	}	return OK;}*//*------------------------------------------------------------------------ * processrtcp - process a single RTCP packet by dispatching the * the appropriate function. *------------------------------------------------------------------------ */intrtcpprocess(struct session *psn, struct rtcp *prtcp, struct netbuf *udpnb){	if (prtcp->rtcp_ver != RTP_CURRVERS) 		return ERROR;	switch (prtcp->rtcp_type) {	case RTCP_SR:		return rtcpsr(psn, prtcp, udpnb);	case RTCP_RR:		return rtcprr(psn, prtcp, udpnb);	case RTCP_SDES:		return rtcpsdes(psn, prtcp, udpnb);	case RTCP_BYE:		return rtcpbye(psn, prtcp, udpnb);	case RTCP_APP:		return rtcpapp(psn, prtcp, udpnb);	default:		return ERROR;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -