mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 02:34:26 +08:00
add more dump
This commit is contained in:
parent
533f35dac4
commit
642ca4997a
@ -15,7 +15,7 @@ namespace SRT {
|
||||
|
||||
using namespace toolkit;
|
||||
|
||||
static const size_t HDR_SIZE = 4; // packet header size = SRT_PH_E_SIZE * sizeof(uint32_t)
|
||||
static const size_t HDR_SIZE = 16; // packet header size = SRT_PH_E_SIZE * sizeof(uint32_t)
|
||||
|
||||
// Can also be calculated as: sizeof(struct ether_header) + sizeof(struct ip) + sizeof(struct udphdr).
|
||||
static const size_t UDP_HDR_SIZE = 28; // 20 bytes IPv4 + 8 bytes of UDP { u16 sport, dport, len, csum }.
|
||||
|
@ -105,7 +105,7 @@ void SrtTransport::inputSockData(uint8_t *buf, int len, struct sockaddr_storage
|
||||
if(_handleshake_timer){
|
||||
_handleshake_timer.reset();
|
||||
}
|
||||
_pkt_recv_rate_context->inputPacket(_now,len-HDR_SIZE);
|
||||
_pkt_recv_rate_context->inputPacket(_now,len+UDP_HDR_SIZE);
|
||||
//_recv_rate_context->inputPacket(_now, len);
|
||||
|
||||
handleDataPacket(buf, len, addr);
|
||||
@ -484,7 +484,11 @@ void SrtTransport::sendACKPacket() {
|
||||
pkt->pkt_recv_rate = _pkt_recv_rate_context->getPacketRecvRate(recv_rate);
|
||||
pkt->estimated_link_capacity = _estimated_link_capacity_context->getEstimatedLinkCapacity();
|
||||
pkt->recv_rate = recv_rate;
|
||||
TraceL<<pkt->pkt_recv_rate<<" pkt/s "<<recv_rate<<" byte/s "<<pkt->estimated_link_capacity<<" pkt/s (cap)";
|
||||
if(pkt->pkt_recv_rate == 0){
|
||||
TraceL<<pkt->pkt_recv_rate<<" pkt/s "<<recv_rate<<" byte/s "<<pkt->estimated_link_capacity<<" pkt/s (cap)";
|
||||
TraceL<<_pkt_recv_rate_context->dump();
|
||||
}
|
||||
|
||||
pkt->storeToData();
|
||||
_ack_send_timestamp[pkt->ack_number] = _now;
|
||||
_last_ack_pkt_seq_num = pkt->last_ack_pkt_seq_number;
|
||||
|
@ -58,6 +58,25 @@ uint32_t PacketRecvRateContext::getPacketRecvRate(uint32_t &bytesps) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::string PacketRecvRateContext::dump(){
|
||||
_StrPrinter printer;
|
||||
printer <<"dur array : ";
|
||||
for (size_t i = 0; i < SIZE; i++)
|
||||
{
|
||||
printer<<_ts_arr[i]<<" ";
|
||||
}
|
||||
printer <<"\r\n";
|
||||
|
||||
printer <<"size array : ";
|
||||
for (size_t i = 0; i < SIZE; i++)
|
||||
{
|
||||
printer<<_size_arr[i]<<" ";
|
||||
}
|
||||
printer <<"\r\n";
|
||||
|
||||
return std::move(printer);
|
||||
}
|
||||
EstimatedLinkCapacityContext::EstimatedLinkCapacityContext(TimePoint start) : _start(start) {
|
||||
for (size_t i = 0; i < SIZE; i++) {
|
||||
_dur_probe_arr[i] = 1000;
|
||||
|
@ -12,6 +12,7 @@ public:
|
||||
~PacketRecvRateContext() = default;
|
||||
void inputPacket(TimePoint &ts,size_t len = 0);
|
||||
uint32_t getPacketRecvRate(uint32_t& bytesps);
|
||||
std::string dump();
|
||||
static const int SIZE = 16;
|
||||
private:
|
||||
TimePoint _last_arrive_time;
|
||||
@ -30,7 +31,7 @@ public:
|
||||
}
|
||||
void inputPacket(TimePoint &ts,DataPacket::Ptr& pkt);
|
||||
uint32_t getEstimatedLinkCapacity();
|
||||
static const int SIZE = 16;
|
||||
static const int SIZE = 64;
|
||||
private:
|
||||
void probe1Arrival(TimePoint &ts,const DataPacket::Ptr& pkt, bool unordered);
|
||||
void probe2Arrival(TimePoint &ts,const DataPacket::Ptr& pkt);
|
||||
|
Loading…
Reference in New Issue
Block a user