当前位置:网站首页>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即可。
原创文章,转发请带上原文链接,谢谢
边栏推荐
猜你喜欢

target has libraries with conflicting names: libcrypto.a and libssl.a.

arm-2-基础阶段

淘宝分布式文件系统存储(二)

基于语音识别的QT设计的csgo互动类视频游戏

Amazon Cloud Technology Build On-Amazon Neptune's Knowledge Graph-Based Recommendation Model Building Experience

管道重定向

【五一专属】阿里云ECS大测评#五一专属|向所有热爱分享的“技术劳动者”致敬#

LeetCode_Dec_3rd_Week

文件权限管理 ugo

MOOSE平台使用入门攻略——如何运行官方教程的例子
随机推荐
A code example of the PCL method in the domain of DG (Domain Generalization)
ideal life
Socket编程详解
迅雷关闭自动更新
Tencent and NetEase have taken action one after another. What is the metaverse that is so popular that it is out of the circle?
Brief description of database and common operation guide
Implementation of CAS lock-free queue
MySQL批量修改时间字段
C语言无符号整型运算
多线程顺序输出
How to get started with MOOSE platform - an example of how to run the official tutorial
Detailed steps to install MySQL
MOOSE平台官方第二个例子分析——关于创建Kernel,求解对流扩散方程
第一章 绪论
jdbc:mysql://localhost:3306/student?serverTimezone=CTT&useUnicode=true&characterEncoding=utf-8时报错
[CV-Learning] Linear Classifier (SVM Basics)
Usage of SFTP
[daily office][ssh]cheatsheet
关于DG(域泛化)领域的PCL方法的代码实例
管道重定向