//解析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包的反馈
metartc5_jz源码阅读-yang_decode_rtcpCompound
最新推荐文章于 2024-05-25 13:18:44 发布
本文详细描述了如何解析不同类型的RTCP命令,如SR、RR、NACK、PSFB、XR等,通过YangRtcpCompound结构体和相关函数对RTCP数据进行解码和处理的过程。

最低0.47元/天 解锁文章
2153

被折叠的 条评论
为什么被折叠?



