当前位置:网站首页>工作小计 rtcp的length和网络字节序
工作小计 rtcp的length和网络字节序
2022-08-09 02:28:00 【Zip-List】
最近在看zlMediaKit RTCP部分
RFC 5760 RTCP https://rfc2cn.com/rfc5760.html
Length: 16 bits As defined in [1], the length of the RTCP packet in 32-bit words minus one, including the header and any padding.
length的长度是32-bit下(就是有几行) - 1(减去的这个1是通用头 32 bit 4字节)
下图中length长度即为5
zl中解析rtcp长度:( 转换字节序+1(加头) )* 4 (32bit计量转成8bit) 获取到了这个包的字节数
size_t RtcpHeader::getSize() const {
//加上rtcp头长度
size_t a = ntohs(length);
return (1 + a) << 2;
}
另外debug时,看到length长度=1536,ntohs后转化为6。最终结果7*4=28,和我们预计的结果一致28字节长的一个rtcp包
配合计算器+ntohs源码可以看到 转换后即 0000 0000 0000 0110 = 6(网络大端转小端字节序,bit序不用转,网卡帮忙做了)
0xAB --> 0xBA
unsigned short ntohs (unsigned short x)
{
x = (x << 8) | (x >> 8);
return x;
}
0xABCD --> 0xDCBA
unsigned long ntohl(unsigned long x)
{
return (x >> 24) | ((x & 0xff0000) >> 8) | ((x & 0xff00) << 8) | (x << 24);
}
边栏推荐
- Cyclictest 简介 安装 测试
- Likou Brush Question Record 5.1-----59. Spiral Matrix II
- 数字 01 Vivado2018.2安装及实操
- My thoughts on software development
- ROS 、SLAM 学习 error整理
- UsernameAuthenticationFilter授权成功后调用AuthenticationSuccessHandler时的解析
- [ANT]apache ant 安装说明
- 【izpack】使用izpack为你的程序提供安装程序封装
- A40i gxl3680 ts_print报错:tslib: Selected device is not a touchscreen (must support ABS and KEY event
- Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
猜你喜欢

最强分布式锁工具:Redisson

接口自动化测试-接口封装思想

The last exam before the NPDP revision!caution

数字 06 verilog_关于异步FIFO

js实现数组去重的方式(7种)

HMS Core分析服务智能运营6.5.1版本上线

终于有人把灰度发布架构设计讲明白了

Force buckled brush problem record 7.1 -- -- -- -- -- 707. The design list

ROS2错误:不支持OpenGL 1.5 GLRenderSystem:: ci initialiseContext在C: \ \ ws \构建……

Redis - 时间序列数据类型的保存方案和消息队列实现
随机推荐
力扣刷题记录3.1-----977. 有序数组的平方
Mysql 5.7 into the pit
2022 China Eye Expo, China Beijing International Children and Adolescent Eye Health Industry Exhibition
终于有人把灰度发布架构设计讲明白了
力扣刷题记录1.5-----367. 有效的完全平方数
基于JMF视频聊天
gpio子系统和pinctrl子系统(下)
2022/8/8 比赛思维+状压dp
9.1-----24. Swap the nodes in the linked list in pairs
MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor
如何保护智能家居避免黑客攻击
边缘计算的三个关键好处
MySQL/Oracle字符串分割
mysql 5.7 入坑
ApiFile配置环境
yii2的安装之路
js实现数组去重的方式(7种)
The most fierce "employee" in history, madly complaining about the billionaire boss Xiao Zha: So rich, he always wears the same clothes!
全志平台双路LVDS配置
Open3D 点云曲率计算