忽略非法的rtcp ntp时间戳

有些设备在发送sender report rtcp时,其rtp和ntp时间戳一直为0,将导致zlmediakit计算出的ntp时间戳异常
This commit is contained in:
xia-chu 2023-06-17 10:13:29 +08:00
parent ccddb84a19
commit 2410419911

View File

@ -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) { 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); update(rtp_stamp, ntp_stamp_ms);
} }
void NtpStamp::update(uint32_t rtp_stamp, uint64_t 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_rtp_stamp = rtp_stamp;
_last_ntp_stamp_ms = ntp_stamp_ms; _last_ntp_stamp_ms = ntp_stamp_ms;
} }