mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
for srt lantency calculate when handshake
This commit is contained in:
parent
3cca4015c5
commit
b8806657cd
@ -49,7 +49,7 @@ void PacketQueue::tryInsertPkt(DataPacket::Ptr pkt){
|
||||
_pkt_map.emplace(pkt->packet_seq_number, pkt);
|
||||
TraceL<<" cycle packet "<<"expected seq=" << _pkt_expected_seq << " pkt seq=" << pkt->packet_seq_number;
|
||||
}else{
|
||||
TraceL << "drop packet too later "<< "expected seq=" << _pkt_expected_seq << " pkt seq=" << pkt->packet_seq_number;
|
||||
//TraceL << "drop packet too later "<< "expected seq=" << _pkt_expected_seq << " pkt seq=" << pkt->packet_seq_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,8 @@ void SrtTransport::handleHandshakeInduction(HandshakePacket &pkt, struct sockadd
|
||||
sendControlPacket(_handleshake_res, true);
|
||||
return;
|
||||
}
|
||||
|
||||
_induction_ts = _now;
|
||||
_start_timestamp = _now;
|
||||
_init_seq_number = pkt.initial_packet_sequence_number;
|
||||
_max_window_size = pkt.max_flow_window_size;
|
||||
_mtu = pkt.mtu;
|
||||
@ -154,7 +155,7 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
|
||||
HSExtMessage::Ptr req;
|
||||
HSExtStreamID::Ptr sid;
|
||||
uint32_t srt_flag = 0xbf;
|
||||
uint16_t delay = 120;
|
||||
uint16_t delay = DurationCountMicroseconds(_now - _induction_ts)*4/1000;
|
||||
|
||||
for (auto ext : pkt.ext_list) {
|
||||
//TraceL << getIdentifier() << " ext " << ext->dump();
|
||||
@ -170,7 +171,7 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
|
||||
}
|
||||
if(req){
|
||||
srt_flag = req->srt_flag;
|
||||
delay = req->recv_tsbpd_delay;
|
||||
delay = delay <= req->recv_tsbpd_delay ? req->recv_tsbpd_delay : delay;
|
||||
}
|
||||
TraceL << getIdentifier() << " CONCLUSION Phase ";
|
||||
HandshakePacket::Ptr res = std::make_shared<HandshakePacket>();
|
||||
|
@ -102,6 +102,9 @@ private:
|
||||
TimePoint _now;
|
||||
TimePoint _start_timestamp;
|
||||
|
||||
// for calculate rtt for delay
|
||||
TimePoint _induction_ts;
|
||||
|
||||
uint32_t _mtu = 1500;
|
||||
uint32_t _max_window_size = 8192;
|
||||
uint32_t _init_seq_number = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user