代码拉取完成,页面将自动刷新
同步操作将从 夏楚/ZLMediaKit 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "Ack.hpp"
#include "Common.hpp"
namespace SRT {
bool ACKPacket::loadFromData(uint8_t *buf, size_t len) {
if (len < ACK_CIF_SIZE + ControlPacket::HEADER_SIZE) {
return false;
}
_data = BufferRaw::create();
_data->assign((char *)(buf), len);
ControlPacket::loadHeader();
ack_number = loadUint32(type_specific_info);
uint8_t *ptr = (uint8_t *)_data->data() + ControlPacket::HEADER_SIZE;
last_ack_pkt_seq_number = loadUint32(ptr);
ptr += 4;
rtt = loadUint32(ptr);
ptr += 4;
rtt_variance = loadUint32(ptr);
ptr += 4;
available_buf_size = loadUint32(ptr);
ptr += 4;
pkt_recv_rate = loadUint32(ptr);
ptr += 4;
estimated_link_capacity = loadUint32(ptr);
ptr += 4;
recv_rate = loadUint32(ptr);
ptr += 4;
return true;
}
bool ACKPacket::storeToData() {
_data = BufferRaw::create();
_data->setCapacity(HEADER_SIZE + ACK_CIF_SIZE);
_data->setSize(HEADER_SIZE + ACK_CIF_SIZE);
control_type = ControlPacket::ACK;
sub_type = 0;
storeUint32(type_specific_info, ack_number);
storeToHeader();
uint8_t *ptr = (uint8_t *)_data->data() + ControlPacket::HEADER_SIZE;
storeUint32(ptr, last_ack_pkt_seq_number);
ptr += 4;
storeUint32(ptr, rtt);
ptr += 4;
storeUint32(ptr, rtt_variance);
ptr += 4;
storeUint32(ptr, available_buf_size);
ptr += 4;
storeUint32(ptr, pkt_recv_rate);
ptr += 4;
storeUint32(ptr, estimated_link_capacity);
ptr += 4;
storeUint32(ptr, recv_rate);
ptr += 4;
return true;
}
std::string ACKPacket::dump() {
_StrPrinter printer;
printer << "last_ack_pkt_seq_number=" << last_ack_pkt_seq_number << " rtt=" << rtt
<< " rtt_variance=" << rtt_variance << " pkt_recv_rate=" << pkt_recv_rate
<< " available_buf_size=" << available_buf_size << " estimated_link_capacity=" << estimated_link_capacity
<< " recv_rate=" << recv_rate;
return std::move(printer);
}
} // namespace SRT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。