确保ntp时间戳获取失败时,webrtc rtp重传缓存列队长度正常

This commit is contained in:
xiongziliang 2022-02-27 01:02:54 +08:00
parent db3df7b92e
commit b82cd5a500
3 changed files with 5 additions and 5 deletions

View File

@ -538,8 +538,8 @@ uint32_t RtpPacket::getStamp() const {
return ntohl(getHeader()->stamp);
}
uint32_t RtpPacket::getStampMS() const {
return ntp_stamp & 0xFFFFFFFF;
uint32_t RtpPacket::getStampMS(bool ntp) const {
return ntp ? ntp_stamp & 0xFFFFFFFF : getStamp() * uint64_t(1000) / sample_rate;
}
uint32_t RtpPacket::getSSRC() const {

View File

@ -159,7 +159,7 @@ public:
uint16_t getSeq() const;
uint32_t getStamp() const;
//主机字节序的时间戳,已经转换为毫秒
uint32_t getStampMS() const;
uint32_t getStampMS(bool ntp = true) const;
//主机字节序的ssrc
uint32_t getSSRC() const;
//有效负载跳过csrc、ext

View File

@ -60,8 +60,8 @@ uint32_t NackList::get_cache_ms() {
if (_nack_cache_seq.size() < 2) {
return 0;
}
uint32_t back = _nack_cache_pkt[_nack_cache_seq.back()]->getStampMS();
uint32_t front = _nack_cache_pkt[_nack_cache_seq.front()]->getStampMS();
uint32_t back = _nack_cache_pkt[_nack_cache_seq.back()]->getStampMS(false);
uint32_t front = _nack_cache_pkt[_nack_cache_seq.front()]->getStampMS(false);
if (back >= front) {
return back - front;
}