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); + } } ////////////////////////////////////////////////////////////////////////////////////