metartc5_jz源码阅读-yang_decode_rtcpCompound

本文详细描述了如何解析不同类型的RTCP命令,如SR、RR、NACK、PSFB、XR等,通过YangRtcpCompound结构体和相关函数对RTCP数据进行解码和处理的过程。
//解析rtcp的命令到rtcps中。
int32_t yang_decode_rtcpCompound(YangRtcpCompound* rtcps,YangBuffer *buffer){
	if(rtcps==NULL) return 1;
	int32_t err = Yang_Ok;
	rtcps->data = buffer->data;
	rtcps->nb_data = buffer->size;

	//如果buffer中不为空则循环遍历每条命令。
	while (!yang_buffer_empty(buffer)) {
		
		//创建YangRtcpCommon结构体用于保存单条rtcp的数据。
		YangRtcpCommon* rtcp = (YangRtcpCommon*)calloc(1,sizeof(YangRtcpCommon));
		YangRtcpHeader* header = (YangRtcpHeader*)(buffer->head);
		
		//如果是sr则创建sr并解析sr,sr是指接收方不光作为rtp数据的接收者还是rtp数据的发送者,这时接收方发送给接收方的type就是sr。
		//sr中包含接收方接收了多少包,丢失了多少包,还包含接收方的发送信息。
		if (header->type == YangRtcpType_sr) {
			yang_create_rtcpSR(rtcp);
			err=yang_decode_rtcpSR(rtcp,buffer);

		} else if (header->type == YangRtcpType_rr) {

			//如果是rr则创建rr并解析rr,rr是指接收方仅作为rtp数据的接收者
			//rr中包含接收方接收了多少包,丢失了多少包。
			yang_create_rtcpRR(rtcp);
			err=yang_decode_rtcpRR(rtcp,buffer);

		} else if (header->type == YangRtcpType_rtpfb) {

			//rtpfb表示接收方接收的rtp包的反馈
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王方帅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值