mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
srt optimize ack send logic ignore too many ack packet
This commit is contained in:
parent
02aad5d256
commit
c363b30360
@ -292,7 +292,7 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
//_last_ack_pkt_seq_num = _init_seq_number;
|
_last_ack_pkt_seq = _init_seq_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrtTransport::handleHandshake(uint8_t *buf, int len, struct sockaddr_storage *addr) {
|
void SrtTransport::handleHandshake(uint8_t *buf, int len, struct sockaddr_storage *addr) {
|
||||||
@ -437,7 +437,13 @@ void SrtTransport::checkAndSendAckNak(){
|
|||||||
_light_ack_pkt_count = 0;
|
_light_ack_pkt_count = 0;
|
||||||
_ack_ticker.resetTime(_now);
|
_ack_ticker.resetTime(_now);
|
||||||
// send a ack per 10 ms for receiver
|
// send a ack per 10 ms for receiver
|
||||||
sendACKPacket();
|
if(_last_ack_pkt_seq != _recv_buf->getExpectedSeq()){
|
||||||
|
//TraceL<<"send a ack packet";
|
||||||
|
sendACKPacket();
|
||||||
|
}else{
|
||||||
|
//TraceL<<" ignore repeate ack packet";
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (_light_ack_pkt_count >= 64) {
|
if (_light_ack_pkt_count >= 64) {
|
||||||
// for high bitrate stream send light ack
|
// for high bitrate stream send light ack
|
||||||
@ -519,7 +525,7 @@ void SrtTransport::sendACKPacket() {
|
|||||||
}
|
}
|
||||||
pkt->storeToData();
|
pkt->storeToData();
|
||||||
_ack_send_timestamp[pkt->ack_number] = _now;
|
_ack_send_timestamp[pkt->ack_number] = _now;
|
||||||
//_last_ack_pkt_seq_num = pkt->last_ack_pkt_seq_number;
|
_last_ack_pkt_seq = pkt->last_ack_pkt_seq_number;
|
||||||
sendControlPacket(pkt, true);
|
sendControlPacket(pkt, true);
|
||||||
// TraceL<<"send ack "<<pkt->dump();
|
// TraceL<<"send ack "<<pkt->dump();
|
||||||
// TraceL<<_recv_buf->dump();
|
// TraceL<<_recv_buf->dump();
|
||||||
@ -539,7 +545,7 @@ void SrtTransport::sendLightACKPacket() {
|
|||||||
pkt->estimated_link_capacity = 0;
|
pkt->estimated_link_capacity = 0;
|
||||||
pkt->recv_rate = 0;
|
pkt->recv_rate = 0;
|
||||||
pkt->storeToData();
|
pkt->storeToData();
|
||||||
//_last_ack_pkt_seq_num = pkt->last_ack_pkt_seq_number;
|
_last_ack_pkt_seq = pkt->last_ack_pkt_seq_number;
|
||||||
sendControlPacket(pkt, true);
|
sendControlPacket(pkt, true);
|
||||||
TraceL << "send ack " << pkt->dump();
|
TraceL << "send ack " << pkt->dump();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ private:
|
|||||||
uint32_t _rtt_variance = 50 * 1000;
|
uint32_t _rtt_variance = 50 * 1000;
|
||||||
uint32_t _light_ack_pkt_count = 0;
|
uint32_t _light_ack_pkt_count = 0;
|
||||||
uint32_t _ack_number_count = 0;
|
uint32_t _ack_number_count = 0;
|
||||||
//uint32_t _last_ack_pkt_seq_num = 0;
|
uint32_t _last_ack_pkt_seq = 0;
|
||||||
uint32_t _last_recv_ackack_seq_num = 0;
|
uint32_t _last_recv_ackack_seq_num = 0;
|
||||||
|
|
||||||
uint32_t _last_pkt_seq = 0;
|
uint32_t _last_pkt_seq = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user