Keep congestion state only in BWE. (#3224)

This commit is contained in:
Raja Subramanian
2024-12-02 09:42:51 +05:30
committed by GitHub
parent 7f0c14306f
commit 3c42ccbb64
6 changed files with 35 additions and 18 deletions
@@ -331,6 +331,8 @@ func newCongestionDetector(params congestionDetectorParams) *congestionDetector
twccFeedback: newTWCCFeedback(twccFeedbackParams{Logger: params.Logger}),
wake: make(chan struct{}, 1),
estimatedAvailableChannelCapacity: 100_000_000,
congestionState: bwe.CongestionStateNone,
congestionStateSwitchedAt: mono.Now(),
}
c.feedbackReports.SetMinCapacity(3)
@@ -339,14 +341,6 @@ func newCongestionDetector(params congestionDetectorParams) *congestionDetector
return c
}
func (c *congestionDetector) Reset() {
// SSBWE-TODO
// 1. may be clear all packet groups?
// 2. reset congestion state to none
// 3. reset estimate to 100 Mbps
// 4. reset packet_tracker?? maybe only the probe state??
}
func (c *congestionDetector) Stop() {
c.stop.Break()
}
@@ -377,6 +371,13 @@ func (c *congestionDetector) HandleTWCCFeedback(report *rtcp.TransportLayerCC) {
}
}
func (c *congestionDetector) CongestionState() bwe.CongestionState {
c.lock.RLock()
defer c.lock.RUnlock()
return c.congestionState
}
func (c *congestionDetector) prunePacketGroups() {
if len(c.packetGroups) == 0 {
return
+8 -1
View File
@@ -90,7 +90,10 @@ func (s *SendSideBWE) SetBWEListener(bweListener bwe.BWEListener) {
}
func (s *SendSideBWE) Reset() {
s.congestionDetector.Reset()
s.congestionDetector = newCongestionDetector(congestionDetectorParams{
Config: s.params.Config.CongestionDetector,
Logger: s.params.Logger,
})
}
func (s *SendSideBWE) Stop() {
@@ -101,4 +104,8 @@ func (s *SendSideBWE) HandleTWCCFeedback(report *rtcp.TransportLayerCC) {
s.congestionDetector.HandleTWCCFeedback(report)
}
func (s *SendSideBWE) CongestionState() bwe.CongestionState {
return s.congestionDetector.CongestionState()
}
// ------------------------------------------------