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:
Raja Subramanian
2022-02-17 13:33:44 +05:30
committed by GitHub
parent 0bbed7f0bd
commit d04f4d12d1
4 changed files with 99 additions and 19 deletions
+15 -6
View File
@@ -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) {