diff --git a/src/Common/Stamp.cpp b/src/Common/Stamp.cpp index 3cb5ee32..a19b96d6 100644 --- a/src/Common/Stamp.cpp +++ b/src/Common/Stamp.cpp @@ -231,14 +231,15 @@ bool DtsGenerator::getDts_l(uint64_t pts, uint64_t &dts) { } void NtpStamp::setNtpStamp(uint32_t rtp_stamp, uint64_t ntp_stamp_ms) { + if (!ntp_stamp_ms || !rtp_stamp) { + // 实测发现有些rtsp服务器发送的rtp时间戳和ntp时间戳一直为0 + WarnL << "Invalid sender report rtcp, ntp_stamp_ms = " << ntp_stamp_ms << ", rtp_stamp = " << rtp_stamp; + return; + } update(rtp_stamp, ntp_stamp_ms); } void NtpStamp::update(uint32_t rtp_stamp, uint64_t ntp_stamp_ms) { - if (ntp_stamp_ms == 0) { - // 实测发现有些rtsp服务器发送的rtp时间戳和ntp时间戳一直为0 - return; - } _last_rtp_stamp = rtp_stamp; _last_ntp_stamp_ms = ntp_stamp_ms; }