当前位置:网站首页>Janus转发丢包导致音视频不同步原因分析
Janus转发丢包导致音视频不同步原因分析
2022-08-04 05:32:00 【睏哥RTC】
音视频不同步:PC和手机互相拉流,过个把小时后,手机拉PC端不同步,PC拉手机端同步,手机退出重进后音视频恢复同步,另外一个手机拉PC也是同步的,初步分析PC发送是正常的,可能是Janus的下行发送在遇到丢包卡顿后时间戳计算有问题,该同步函数在rtp.c文件里,本文记录解读过程。
原型:
void janus_rtp_header_update(janus_rtp_header *header, janus_rtp_switching_context *context, gboolean video, int step)
参数:
janus_rtp_header *header : RTP包
janus_rtp_switching_context *context: 订阅者信息
gboolean video:是否视频包
int step : 未使用
context->v_last_ssrc: 记录订阅者订阅的ssrc,如果该值和推流者不一样,说明是新开始,初始化v_base_seq,v_base_ts等值
context->v_base_ts_prev: 订阅者的起始ts
context->v_base_ts:记录该订阅者是从推流者的开始拉的第一个包的时间戳
context->v_base_seq_prev:
context->v_base_seq: 记录该订阅者是从推流者的第几个seq开始拉流的,比如推流这发了1000个包了,订阅者才开始拉流,则该值为1000
context->v_last_time: 上一包发送时间,函数末尾context->v_last_time = janus_get_monotonic_time();获得
context->v_last_ts:
context->v_new_ssrc:
context->v_seq_reset:
context->v_last_seq:
context->v_prev_ts:
context->v_last_ts:
context->v_prev_seq:
context->v_last_seq:
Janus转发后时间不同步原因:

根本原因在于随着丢包增多,由于Janus把SR里的NTP时间重新计算,作为RTP同步参考的SR里另外那个用累计来计算的timestamp时间与实际发送端的RTP参考的timestamp时间相差越来越多。
所以解决方法为,janus同时转发源端SR即可。
原创文章,转发请带上原文链接,谢谢
边栏推荐
- C语言无符号整型运算
- LeetCode_Dec_2nd_Week
- LeetCode_Dec_1st_Week
- Tencent and NetEase have taken action one after another. What is the metaverse that is so popular that it is out of the circle?
- counting cycle
- 安装pyspider后运行pyspider all后遇到的问题
- MNIST Handwritten Digit Recognition - Building a Perceptron from Zero for Two-Classification
- 第二章 STA相关概念
- 集合---ArrayList的底层
- 关于DG(域泛化)领域的PCL方法的代码实例
猜你喜欢

淘宝分布式文件系统存储引擎(一)

arm-3-中断体系结构

IDEA创建Servlet步骤

Tencent and NetEase have taken action one after another. What is the metaverse that is so popular that it is out of the circle?

Detailed steps to install MySQL

tmux概念和使用
![[Copy Siege Lion Log] Flying Pulp Academy Intensive Learning 7-Day Punch Camp-Study Notes](/img/af/05caea638de8d75f6d3b42b3d8e28f.png)
[Copy Siege Lion Log] Flying Pulp Academy Intensive Learning 7-Day Punch Camp-Study Notes

基于asp.net的法律援助平台的设计与实现(附项目链接)

亚马逊云科技 Build On 2022 - AIot 第二季物联网专场实验心得

Copy Siege Lion 5-minute online experience MindIR format model generation
随机推荐
[Copy Siege Lion Log] Flying Pulp Academy Intensive Learning 7-Day Punch Camp-Study Notes
淘宝分布式文件系统存储引擎(一)
最全的最详细的指针讲解(C语言)
Pytest common plug-in
MOOSE平台官方第二个例子分析——关于创建Kernel,求解对流扩散方程
DRA821 环境搭建
tmux概念和使用
LeetCode_Nov_1st_Week
库函数的模拟实现-C语言
结构体内存对齐-C语言
[English learning][sentence] good sentence
迅雷关闭自动更新
[Development Miscellaneous][Editor][Code Reading]ctags & vim
Socket编程详解
MNIST手写数字识别 —— 从零构建感知机实现二分类
[daily office][ssh]cheatsheet
arm learning-1-development board
LeetCode_Nov_2nd_Week
Shell脚本执行的三种方式
彻底删除MySQL教程