mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SquashSRS4: Support circuit breaker
This commit is contained in:
parent
fd6c653d3c
commit
276bd2223e
16 changed files with 458 additions and 12 deletions
|
|
@ -33,6 +33,12 @@ using namespace std;
|
|||
#include <srs_kernel_rtc_rtp.hpp>
|
||||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_app_utility.hpp>
|
||||
#include <srs_app_threads.hpp>
|
||||
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
extern SrsPps* _srs_pps_snack3;
|
||||
extern SrsPps* _srs_pps_snack4;
|
||||
|
||||
SrsRtpRingBuffer::SrsRtpRingBuffer(int capacity)
|
||||
{
|
||||
|
|
@ -228,6 +234,12 @@ SrsRtpNackForReceiver::~SrsRtpNackForReceiver()
|
|||
|
||||
void SrsRtpNackForReceiver::insert(uint16_t first, uint16_t last)
|
||||
{
|
||||
// If circuit-breaker is enabled, disable nack.
|
||||
if (_srs_circuit_breaker->hybrid_high_water_level()) {
|
||||
++_srs_pps_snack4->sugar;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint16_t s = first; s != last; ++s) {
|
||||
queue_[s] = SrsRtpNackInfo();
|
||||
}
|
||||
|
|
@ -259,6 +271,13 @@ void SrsRtpNackForReceiver::check_queue_size()
|
|||
|
||||
void SrsRtpNackForReceiver::get_nack_seqs(SrsRtcpNack& seqs, uint32_t& timeout_nacks)
|
||||
{
|
||||
// If circuit-breaker is enabled, disable nack.
|
||||
if (_srs_circuit_breaker->hybrid_high_water_level()) {
|
||||
queue_.clear();
|
||||
++_srs_pps_snack4->sugar;
|
||||
return;
|
||||
}
|
||||
|
||||
srs_utime_t now = srs_get_system_time();
|
||||
|
||||
srs_utime_t interval = now - pre_check_time_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue