mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
修复rtp pts 时间戳回退导致ntp时间戳计算异常的bug:#1152
This commit is contained in:
parent
2ec3b0ccea
commit
dd81497e5c
@ -231,9 +231,7 @@ uint64_t NtpStamp::getNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate) {
|
|||||||
if (rtp_stamp == _last_rtp_stamp) {
|
if (rtp_stamp == _last_rtp_stamp) {
|
||||||
return _last_ntp_stamp_ms;
|
return _last_ntp_stamp_ms;
|
||||||
}
|
}
|
||||||
auto ret = getNtpStamp_l(rtp_stamp, sample_rate);
|
return getNtpStamp_l(rtp_stamp, sample_rate);
|
||||||
_last_rtp_stamp = rtp_stamp;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t NtpStamp::getNtpStamp_l(uint32_t rtp_stamp, uint32_t sample_rate) {
|
uint64_t NtpStamp::getNtpStamp_l(uint32_t rtp_stamp, uint32_t sample_rate) {
|
||||||
|
@ -94,7 +94,7 @@ RtpPacket::Ptr RtpTrack::inputRtp(TrackType type, int sample_rate, uint8_t *ptr,
|
|||||||
rtp->ntp_stamp = rtp->getStamp() * uint64_t(1000) / sample_rate;
|
rtp->ntp_stamp = rtp->getStamp() * uint64_t(1000) / sample_rate;
|
||||||
} else {
|
} else {
|
||||||
//设置ntp时间戳
|
//设置ntp时间戳
|
||||||
rtp->ntp_stamp = _ntp_stamp.getNtpStamp(ntohl(rtp->getHeader()->stamp), sample_rate);
|
rtp->ntp_stamp = _ntp_stamp.getNtpStamp(rtp->getStamp(), sample_rate);
|
||||||
}
|
}
|
||||||
onBeforeRtpSorted(rtp);
|
onBeforeRtpSorted(rtp);
|
||||||
sortPacket(rtp->getSeq(), rtp);
|
sortPacket(rtp->getSeq(), rtp);
|
||||||
|
Loading…
Reference in New Issue
Block a user