mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Support disable the NACK no-copy, enable copy by default
This commit is contained in:
parent
50860325dd
commit
f63441413d
7 changed files with 81 additions and 8 deletions
|
@ -1729,6 +1729,7 @@ SrsRtcRecvTrack::SrsRtcRecvTrack(SrsRtcConnection* session, SrsRtcTrackDescripti
|
|||
session_ = session;
|
||||
track_desc_ = track_desc->copy();
|
||||
statistic_ = new SrsRtcTrackStatistic();
|
||||
nack_no_copy_ = false;
|
||||
|
||||
if (is_audio) {
|
||||
rtp_queue_ = new SrsRtpRingBuffer(100);
|
||||
|
@ -1838,8 +1839,12 @@ srs_error_t SrsRtcRecvTrack::on_nack(SrsRtpPacket2** ppkt)
|
|||
|
||||
// insert into video_queue and audio_queue
|
||||
// We directly use the pkt, never copy it, so we should set the pkt to NULL.
|
||||
rtp_queue_->set(seq, pkt);
|
||||
*ppkt = NULL;
|
||||
if (nack_no_copy_) {
|
||||
rtp_queue_->set(seq, pkt);
|
||||
*ppkt = NULL;
|
||||
} else {
|
||||
rtp_queue_->set(seq, pkt->copy());
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -1983,6 +1988,7 @@ SrsRtcSendTrack::SrsRtcSendTrack(SrsRtcConnection* session, SrsRtcTrackDescripti
|
|||
session_ = session;
|
||||
track_desc_ = track_desc->copy();
|
||||
statistic_ = new SrsRtcTrackStatistic();
|
||||
nack_no_copy_ = false;
|
||||
|
||||
if (is_audio) {
|
||||
rtp_queue_ = new SrsRtpRingBuffer(100);
|
||||
|
@ -2058,8 +2064,12 @@ srs_error_t SrsRtcSendTrack::on_nack(SrsRtpPacket2** ppkt)
|
|||
|
||||
// insert into video_queue and audio_queue
|
||||
// We directly use the pkt, never copy it, so we should set the pkt to NULL.
|
||||
rtp_queue_->set(seq, pkt);
|
||||
*ppkt = NULL;
|
||||
if (nack_no_copy_) {
|
||||
rtp_queue_->set(seq, pkt);
|
||||
*ppkt = NULL;
|
||||
} else {
|
||||
rtp_queue_->set(seq, pkt->copy());
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue