rtp使用ntp时间戳作为时间戳,用于实现rtsp音视频同步

This commit is contained in:
ziyue
2021-07-12 21:18:22 +08:00
parent eba3758b30
commit 298f6e3864
17 changed files with 184 additions and 29 deletions

View File

@@ -91,12 +91,19 @@ bool RtpTrack::inputRtp(TrackType type, int sample_rate, uint8_t *ptr, size_t le
//拷贝rtp
memcpy(&data[4], ptr, len);
//设置ntp时间戳
rtp->ntp_stamp = _ntp_stamp.getNtpStamp(ntohl(rtp->getHeader()->stamp), sample_rate);
onBeforeRtpSorted(rtp);
auto seq = rtp->getSeq();
sortPacket(seq, std::move(rtp));
return true;
}
void RtpTrack::setNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate, uint64_t ntp_stamp_ms){
_ntp_stamp.setNtpStamp(rtp_stamp, sample_rate, ntp_stamp_ms);
}
////////////////////////////////////////////////////////////////////////////////////
void RtpTrackImp::setOnSorted(OnSorted cb) {