From b82cd5a500be954f2771883132fd871b2841deae Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 27 Feb 2022 01:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E4=BF=9Dntp=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=E8=8E=B7=E5=8F=96=E5=A4=B1=E8=B4=A5=E6=97=B6=EF=BC=8C?= =?UTF-8?q?webrtc=20rtp=E9=87=8D=E4=BC=A0=E7=BC=93=E5=AD=98=E5=88=97?= =?UTF-8?q?=E9=98=9F=E9=95=BF=E5=BA=A6=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/Rtsp.cpp | 4 ++-- src/Rtsp/Rtsp.h | 2 +- webrtc/Nack.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index b63985a0..9ea1d93d 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -538,8 +538,8 @@ uint32_t RtpPacket::getStamp() const { return ntohl(getHeader()->stamp); } -uint32_t RtpPacket::getStampMS() const { - return ntp_stamp & 0xFFFFFFFF; +uint32_t RtpPacket::getStampMS(bool ntp) const { + return ntp ? ntp_stamp & 0xFFFFFFFF : getStamp() * uint64_t(1000) / sample_rate; } uint32_t RtpPacket::getSSRC() const { diff --git a/src/Rtsp/Rtsp.h b/src/Rtsp/Rtsp.h index 84db8e84..ca9c00be 100644 --- a/src/Rtsp/Rtsp.h +++ b/src/Rtsp/Rtsp.h @@ -159,7 +159,7 @@ public: uint16_t getSeq() const; uint32_t getStamp() const; //主机字节序的时间戳,已经转换为毫秒 - uint32_t getStampMS() const; + uint32_t getStampMS(bool ntp = true) const; //主机字节序的ssrc uint32_t getSSRC() const; //有效负载,跳过csrc、ext diff --git a/webrtc/Nack.cpp b/webrtc/Nack.cpp index 6628e507..60d314b3 100644 --- a/webrtc/Nack.cpp +++ b/webrtc/Nack.cpp @@ -60,8 +60,8 @@ uint32_t NackList::get_cache_ms() { if (_nack_cache_seq.size() < 2) { return 0; } - uint32_t back = _nack_cache_pkt[_nack_cache_seq.back()]->getStampMS(); - uint32_t front = _nack_cache_pkt[_nack_cache_seq.front()]->getStampMS(); + uint32_t back = _nack_cache_pkt[_nack_cache_seq.back()]->getStampMS(false); + uint32_t front = _nack_cache_pkt[_nack_cache_seq.front()]->getStampMS(false); if (back >= front) { return back - front; }