Use min packets threshold for NACK based congestion signal.

This commit is contained in:
boks1971
2023-07-13 00:18:01 +05:30
parent 8dc2c005c3
commit 0bf93042ed
3 changed files with 6 additions and 5 deletions
+2 -4
View File
@@ -61,6 +61,7 @@ type ChannelObserverParams struct {
EstimateDownwardTrendThreshold float64
EstimateCollapseThreshold time.Duration
EstimateValidityWindow time.Duration
NackMinPackets uint32
NackWindowMinDuration time.Duration
NackWindowMaxDuration time.Duration
NackRatioThreshold float64
@@ -72,10 +73,6 @@ type ChannelObserver struct {
estimateTrend *TrendDetector
nackTracker *NackTracker
nackWindowStartTime time.Time
packets uint32
repeatedNacks uint32
}
func NewChannelObserver(params ChannelObserverParams, logger logger.Logger) *ChannelObserver {
@@ -93,6 +90,7 @@ func NewChannelObserver(params ChannelObserverParams, logger logger.Logger) *Cha
nackTracker: NewNackTracker(NackTrackerParams{
Name: params.Name + "-nack",
Logger: logger,
MinPackets: params.NackMinPackets,
WindowMinDuration: params.NackWindowMinDuration,
WindowMaxDuration: params.NackWindowMaxDuration,
RatioThreshold: params.NackRatioThreshold,
+2 -1
View File
@@ -12,6 +12,7 @@ import (
type NackTrackerParams struct {
Name string
Logger logger.Logger
MinPackets uint32
WindowMinDuration time.Duration
WindowMaxDuration time.Duration
RatioThreshold float64
@@ -62,7 +63,7 @@ func (n *NackTracker) Add(packets uint32, repeatedNacks uint32) {
func (n *NackTracker) GetRatio() float64 {
ratio := 0.0
if n.packets != 0 {
if n.packets != 0 && n.packets >= n.params.MinPackets {
ratio = float64(n.repeatedNacks) / float64(n.packets)
if ratio > 1.0 {
ratio = 1.0
@@ -46,6 +46,7 @@ var (
EstimateDownwardTrendThreshold: 0.0,
EstimateCollapseThreshold: 0,
EstimateValidityWindow: 10 * time.Second,
NackMinPackets: 0,
NackWindowMinDuration: 500 * time.Millisecond,
NackWindowMaxDuration: 1 * time.Second,
NackRatioThreshold: 0.04,
@@ -57,6 +58,7 @@ var (
EstimateDownwardTrendThreshold: -0.5,
EstimateCollapseThreshold: 500 * time.Millisecond,
EstimateValidityWindow: 10 * time.Second,
NackMinPackets: 50,
NackWindowMinDuration: 1 * time.Second,
NackWindowMaxDuration: 2 * time.Second,
NackRatioThreshold: 0.08,