From b3ad0891e62329d0465a7423f050026601f615a6 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Sun, 22 Aug 2021 15:13:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=99=A40=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/Stamp.cpp | 1 + src/Rtsp/RtpReceiver.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Common/Stamp.cpp b/src/Common/Stamp.cpp index 5d3230aa..d4d22929 100644 --- a/src/Common/Stamp.cpp +++ b/src/Common/Stamp.cpp @@ -219,6 +219,7 @@ bool DtsGenerator::getDts_l(uint32_t pts, uint32_t &dts){ } void NtpStamp::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms) { + assert(sample_rate); update(uint64_t(rtp_stamp) * 1000 / sample_rate, ntp_stamp_ms); } diff --git a/src/Rtsp/RtpReceiver.cpp b/src/Rtsp/RtpReceiver.cpp index 635fb117..630805cd 100644 --- a/src/Rtsp/RtpReceiver.cpp +++ b/src/Rtsp/RtpReceiver.cpp @@ -103,7 +103,9 @@ RtpPacket::Ptr RtpTrack::inputRtp(TrackType type, int sample_rate, uint8_t *ptr, void RtpTrack::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms) { _disable_ntp = rtp_stamp == 0 && sample_rate == 0 && ntp_stamp_ms == 0; - _ntp_stamp.setNtpStamp(rtp_stamp, sample_rate, ntp_stamp_ms); + if (sample_rate) { + _ntp_stamp.setNtpStamp(rtp_stamp, sample_rate, ntp_stamp_ms); + } } ////////////////////////////////////////////////////////////////////////////////////