From 93c6754fc47a3f223424ef7e202eef45262a6cc7 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Wed, 20 Oct 2021 11:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=B8=80=E4=BA=9B=E4=B8=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84rtsp=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtcp/Rtcp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Rtcp/Rtcp.cpp b/src/Rtcp/Rtcp.cpp index 707e08e4..2960743f 100644 --- a/src/Rtcp/Rtcp.cpp +++ b/src/Rtcp/Rtcp.cpp @@ -264,6 +264,11 @@ string RtcpSR::getNtpStamp() const{ } uint64_t RtcpSR::getNtpUnixStampMS() const { + if (ntpmsw < 0x83AA7E80) { + //ntp时间戳起始时间为1900年,但是utc时间戳起始时间为1970年,两者相差0x83AA7E80秒 + //ntp时间戳不得早于1970年,否则无法转换为utc时间戳 + return 0; + } struct timeval tv; tv.tv_sec = ntpmsw - 0x83AA7E80; tv.tv_usec = (decltype(tv.tv_usec)) (ntplsw / ((double) (((uint64_t) 1) << 32) * 1.0e-6));