完善相对时间戳逻辑, 完善同步机制, 解决相对时间戳不同步的问题

默认禁止时间戳回退并设置最大跳跃幅度为300毫秒
rtsp恢复产生ntp时间戳
由于绝对时间戳可能跳跃回退,之前在求相对时间戳时会导致音视频不同步。
现在求相对时间戳逻辑经过修改,已经支持同步功能,所以恢复rtp ntp时间戳逻辑
This commit is contained in:
xia-chu
2023-11-25 10:43:51 +08:00
committed by 夏楚
parent bd22c44ee9
commit 0f4e0e1076
3 changed files with 75 additions and 17 deletions

View File

@@ -14,7 +14,7 @@
using namespace std;
using namespace toolkit;
#define ENABLE_NTP_STAMP 0
#define ENABLE_NTP_STAMP 1
namespace mediakit {
@@ -78,6 +78,10 @@ bool RtspMuxer::addTrack(const Track::Ptr &track) {
//添加其sdp
_sdp.append(sdp->getSdp());
trySyncTrack();
// rtp的时间戳是pts允许回退
_stamp[TrackAudio].enableRollback(true);
_stamp[TrackVideo].enableRollback(true);
return true;
}