RTC: Send NACK one by one to avoid packet freed by context switching

pull/2204/head
winlin 4 years ago
parent e1a840772d
commit 33f4e02072

@ -2042,14 +2042,12 @@ srs_error_t SrsRtcSendTrack::on_recv_nack(const vector<uint16_t>& lost_seqs, Srs
statistic->nacks++;
vector<SrsRtpPacket2*> resend_pkts;
for(int i = 0; i < (int)lost_seqs.size(); ++i) {
uint16_t seq = lost_seqs.at(i);
SrsRtpPacket2* pkt = fetch_rtp_packet(seq);
if (pkt == NULL) {
continue;
}
resend_pkts.push_back(pkt);
info.nn_bytes += pkt->nb_bytes();
uint32_t nn = 0;
@ -2057,11 +2055,14 @@ 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(),
pkt->header.get_ssrc(), pkt->header.get_timestamp(), nn, nack_epp->nn_count, pkt->nb_bytes());
}
}
// By default, we send packets by sendmmsg.
if ((err = session_->do_send_packets(resend_pkts, info)) != srs_success) {
return srs_error_wrap(err, "raw send");
vector<SrsRtpPacket2*> resend_pkts;
resend_pkts.push_back(pkt);
// By default, we send packets by sendmmsg.
if ((err = session_->do_send_packets(resend_pkts, info)) != srs_success) {
return srs_error_wrap(err, "raw send");
}
}
return err;

Loading…
Cancel
Save