mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Send NACK one by one to avoid packet freed by context switching
This commit is contained in:
parent
e1a840772d
commit
33f4e02072
1 changed files with 7 additions and 6 deletions
|
@ -2042,14 +2042,12 @@ srs_error_t SrsRtcSendTrack::on_recv_nack(const vector<uint16_t>& lost_seqs, Srs
|
||||||
|
|
||||||
statistic->nacks++;
|
statistic->nacks++;
|
||||||
|
|
||||||
vector<SrsRtpPacket2*> resend_pkts;
|
|
||||||
for(int i = 0; i < (int)lost_seqs.size(); ++i) {
|
for(int i = 0; i < (int)lost_seqs.size(); ++i) {
|
||||||
uint16_t seq = lost_seqs.at(i);
|
uint16_t seq = lost_seqs.at(i);
|
||||||
SrsRtpPacket2* pkt = fetch_rtp_packet(seq);
|
SrsRtpPacket2* pkt = fetch_rtp_packet(seq);
|
||||||
if (pkt == NULL) {
|
if (pkt == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
resend_pkts.push_back(pkt);
|
|
||||||
|
|
||||||
info.nn_bytes += pkt->nb_bytes();
|
info.nn_bytes += pkt->nb_bytes();
|
||||||
uint32_t nn = 0;
|
uint32_t nn = 0;
|
||||||
|
@ -2057,12 +2055,15 @@ srs_error_t SrsRtcSendTrack::on_recv_nack(const vector<uint16_t>& lost_seqs, Srs
|
||||||
srs_trace("RTC NACK ARQ seq=%u, ssrc=%u, ts=%u, count=%u/%u, %d bytes", pkt->header.get_sequence(),
|
srs_trace("RTC NACK ARQ seq=%u, ssrc=%u, ts=%u, count=%u/%u, %d bytes", pkt->header.get_sequence(),
|
||||||
pkt->header.get_ssrc(), pkt->header.get_timestamp(), nn, nack_epp->nn_count, pkt->nb_bytes());
|
pkt->header.get_ssrc(), pkt->header.get_timestamp(), nn, nack_epp->nn_count, pkt->nb_bytes());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
vector<SrsRtpPacket2*> resend_pkts;
|
||||||
|
resend_pkts.push_back(pkt);
|
||||||
|
|
||||||
// By default, we send packets by sendmmsg.
|
// By default, we send packets by sendmmsg.
|
||||||
if ((err = session_->do_send_packets(resend_pkts, info)) != srs_success) {
|
if ((err = session_->do_send_packets(resend_pkts, info)) != srs_success) {
|
||||||
return srs_error_wrap(err, "raw send");
|
return srs_error_wrap(err, "raw send");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue