mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Reorder code for NACK.
This commit is contained in:
parent
f2951ec46a
commit
31de2c71d0
2 changed files with 17 additions and 13 deletions
|
@ -141,6 +141,14 @@ void SrsRtpRingBuffer::notify_drop_seq(uint16_t seq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SrsNackOption::SrsNackOption()
|
||||||
|
{
|
||||||
|
max_count = 10;
|
||||||
|
max_alive_time = 2 * SRS_UTIME_SECONDS;
|
||||||
|
first_nack_interval = 10 * SRS_UTIME_MILLISECONDS;
|
||||||
|
nack_interval = 400 * SRS_UTIME_MILLISECONDS;
|
||||||
|
}
|
||||||
|
|
||||||
SrsRtpNackInfo::SrsRtpNackInfo()
|
SrsRtpNackInfo::SrsRtpNackInfo()
|
||||||
{
|
{
|
||||||
generate_time_ = srs_update_system_time();
|
generate_time_ = srs_update_system_time();
|
||||||
|
@ -148,6 +156,10 @@ SrsRtpNackInfo::SrsRtpNackInfo()
|
||||||
req_nack_count_ = 0;
|
req_nack_count_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SrsRtpNackForReceiver::SeqComp::operator()(const uint16_t& low, const uint16_t& high) const {
|
||||||
|
return srs_rtp_seq_distance(low, high) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
SrsRtpNackForReceiver::SrsRtpNackForReceiver(SrsRtpRingBuffer* rtp, size_t queue_size)
|
SrsRtpNackForReceiver::SrsRtpNackForReceiver(SrsRtpRingBuffer* rtp, size_t queue_size)
|
||||||
{
|
{
|
||||||
max_queue_size_ = queue_size;
|
max_queue_size_ = queue_size;
|
||||||
|
|
|
@ -101,39 +101,31 @@ public:
|
||||||
|
|
||||||
struct SrsNackOption
|
struct SrsNackOption
|
||||||
{
|
{
|
||||||
SrsNackOption()
|
|
||||||
{
|
|
||||||
// Default nack option.
|
|
||||||
max_count = 10;
|
|
||||||
max_alive_time = 2 * SRS_UTIME_SECONDS;
|
|
||||||
first_nack_interval = 10 * SRS_UTIME_MILLISECONDS;
|
|
||||||
nack_interval = 400 * SRS_UTIME_MILLISECONDS;
|
|
||||||
}
|
|
||||||
int max_count;
|
int max_count;
|
||||||
srs_utime_t max_alive_time;
|
srs_utime_t max_alive_time;
|
||||||
int64_t first_nack_interval;
|
int64_t first_nack_interval;
|
||||||
int64_t nack_interval;
|
int64_t nack_interval;
|
||||||
|
|
||||||
|
SrsNackOption();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SrsRtpNackInfo
|
struct SrsRtpNackInfo
|
||||||
{
|
{
|
||||||
SrsRtpNackInfo();
|
|
||||||
|
|
||||||
// Use to control the time of first nack req and the life of seq.
|
// Use to control the time of first nack req and the life of seq.
|
||||||
srs_utime_t generate_time_;
|
srs_utime_t generate_time_;
|
||||||
// Use to control nack interval.
|
// Use to control nack interval.
|
||||||
srs_utime_t pre_req_nack_time_;
|
srs_utime_t pre_req_nack_time_;
|
||||||
// Use to control nack times.
|
// Use to control nack times.
|
||||||
int req_nack_count_;
|
int req_nack_count_;
|
||||||
|
|
||||||
|
SrsRtpNackInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SrsRtpNackForReceiver
|
class SrsRtpNackForReceiver
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct SeqComp {
|
struct SeqComp {
|
||||||
bool operator()(const uint16_t& low, const uint16_t& high) const {
|
bool operator()(const uint16_t& low, const uint16_t& high) const;
|
||||||
return srs_rtp_seq_distance(low, high) > 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
// Nack queue, seq order, oldest to newest.
|
// Nack queue, seq order, oldest to newest.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue