From 226b87a633e9d7ff945836ae06535717b082198c Mon Sep 17 00:00:00 2001 From: ss002012 <15290873633@126.com> Date: Mon, 18 Nov 2024 14:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96rtsp=20ntp=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=EF=BC=8C=E9=98=B2=E6=AD=A2=E9=9F=B3=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E6=AD=A5(=20#4017=20#4018)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rtp时间戳可能被截断,ntp时间戳生成时优先使用未截断的原始时间戳,防止音视频不同步 --- src/Rtsp/RtspMuxer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Rtsp/RtspMuxer.cpp b/src/Rtsp/RtspMuxer.cpp index e28b526e..1e75a03f 100644 --- a/src/Rtsp/RtspMuxer.cpp +++ b/src/Rtsp/RtspMuxer.cpp @@ -23,11 +23,10 @@ void RtspMuxer::onRtp(RtpPacket::Ptr in, bool is_key) { if (ref.rtp_stamp != in->getHeader()->stamp) { // rtp时间戳变化才计算ntp,节省cpu资源 [AUTO-TRANSLATED:729d54f2] // Only calculate NTP when the RTP timestamp changes, saving CPU resources - int64_t stamp_ms = in->getStamp() * uint64_t(1000) / in->sample_rate; int64_t stamp_ms_inc; // 求rtp时间戳增量 [AUTO-TRANSLATED:f6ba022f] // Get the RTP timestamp increment - ref.stamp.revise(stamp_ms, stamp_ms, stamp_ms_inc, stamp_ms_inc); + ref.stamp.revise(in->ntp_stamp, in->ntp_stamp, stamp_ms_inc, stamp_ms_inc); ref.rtp_stamp = in->getHeader()->stamp; ref.ntp_stamp = stamp_ms_inc + _ntp_stamp_start; }