Throttle RTX under certain conditions to prevent RTX storm (#440)
* WIP commit * WIP commit * WIP commit * WIP commit * WIP commit * WIP commit * WIP commit * WIP commit * Clean up * Remove debug * Remove unneeded change * fix test * Remove incorrect comment * WIP commit * Reset probe after estimate trends down * WIP commit * variable name change * Clean up * Remove debug logs * gofmt
This commit is contained in:
+15
-6
@@ -17,6 +17,7 @@ import (
|
||||
//
|
||||
const (
|
||||
FlagPauseOnDowngrade = true
|
||||
FlagFilterRTX = true
|
||||
)
|
||||
|
||||
type ForwardingStatus int
|
||||
@@ -1138,10 +1139,17 @@ func (f *Forwarder) Resync() {
|
||||
f.lastSSRC = 0
|
||||
}
|
||||
|
||||
func (f *Forwarder) IsRtxAllowed(layer int32) bool {
|
||||
func (f *Forwarder) FilterRTX(nacks []uint16) (filtered []uint16, disallowedLayers [DefaultMaxLayerSpatial + 1]bool) {
|
||||
if !FlagFilterRTX {
|
||||
filtered = nacks
|
||||
return
|
||||
}
|
||||
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
|
||||
filtered = f.rtpMunger.FilterRTX(nacks)
|
||||
|
||||
//
|
||||
// Curb RTX when deficient for two cases
|
||||
// 1. Target layer is lower than current layer. When current hits target, a key frame should flush the decoder.
|
||||
@@ -1150,13 +1158,14 @@ func (f *Forwarder) IsRtxAllowed(layer int32) bool {
|
||||
//
|
||||
// Without the curb, when congestion hits, RTX rate could be so high that it further congests the channel.
|
||||
//
|
||||
if FlagPauseOnDowngrade &&
|
||||
f.lastAllocation.state == VideoAllocationStateDeficient &&
|
||||
(f.targetLayers.spatial < f.currentLayers.spatial || layer > f.currentLayers.spatial) {
|
||||
return false
|
||||
for layer := int32(0); layer < DefaultMaxLayerSpatial+1; layer++ {
|
||||
if f.lastAllocation.state == VideoAllocationStateDeficient &&
|
||||
(f.targetLayers.spatial < f.currentLayers.spatial || layer > f.currentLayers.spatial) {
|
||||
disallowedLayers[layer] = true
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
return
|
||||
}
|
||||
|
||||
func (f *Forwarder) GetTranslationParams(extPkt *buffer.ExtPacket, layer int32) (*TranslationParams, error) {
|
||||
|
||||
Reference in New Issue
Block a user