兼容一些不规范的rtsp流

This commit is contained in:
ziyue 2021-10-20 11:54:05 +08:00
parent cf1adf1c92
commit 93c6754fc4

View File

@ -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));