Move Prober to ccutils. (#3175)

* keep track of RTX bytes separately

* packet group

* Packet group of 50ms

* Minor refactoring

* rate calculator

* send bit rate

* WIP

* comment

* reduce packet infos size

* extended twcc seq num

* fix packet info

* WIP

* queuing delay

* refactor

* config

* callbacks

* fixes

* clean up

* remove debug file, fix rate calculation

* fmt

* fix probes

* format

* notes

* check loss

* tweak detection settings

* 24-bit wrap

* clean up a bit

* limit symbol list to number of packets

* fmt

* clean up

* lost

* fixes

* fmt

* rename

* fixes

* fmt

* use min/max

* hold on early warning of congestion

* make note about need for all optimal allocation on hold release

* estimate trend in congested state

* tweaks

* quantized

* fmt

* TrendDetector generics

* CTR trend

* tweaks

* config

* config

* comments

* clean up

* consistent naming

* pariticpant level setting

* log usage mode

* probing hacks

* WIP

* no lock

* packet group config

* ctr trend refactor

* cleanup and fixes

* format

* debug

* format

* move prober to ccutils

* clean up

* clean up
This commit is contained in:
Raja Subramanian
2024-11-15 00:05:59 +05:30
committed by GitHub
parent 9e4dae7107
commit adaf56a30d
7 changed files with 166 additions and 112 deletions
+22 -16
View File
@@ -30,6 +30,7 @@ import (
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/livekit-server/pkg/sfu/ccutils"
"github.com/livekit/livekit-server/pkg/sfu/sendsidebwe"
"github.com/livekit/livekit-server/pkg/utils"
)
@@ -195,7 +196,7 @@ type StreamAllocator struct {
probeController *ProbeController
prober *Prober
prober *ccutils.Prober
channelObserver *ChannelObserver
// STREAM-ALLOCATOR-DATA rateMonitor *RateMonitor
@@ -218,7 +219,7 @@ func NewStreamAllocator(params StreamAllocatorParams, enabled bool, allowPause b
params: params,
enabled: enabled,
allowPause: allowPause,
prober: NewProber(ProberParams{
prober: ccutils.NewProber(ccutils.ProberParams{
Logger: params.Logger,
}),
// STREAM-ALLOCATOR-DATA rateMonitor: NewRateMonitor(),
@@ -562,7 +563,7 @@ func (s *StreamAllocator) OnSendProbe(bytesToSend int) {
}
// called when prober finishes a probe cluster, could be called when prober is reset which stops an active cluster
func (s *StreamAllocator) OnProbeClusterDone(info ProbeClusterInfo) {
func (s *StreamAllocator) OnProbeClusterDone(info ccutils.ProbeClusterInfo) {
s.postEvent(Event{
Signal: streamAllocatorSignalProbeClusterDone,
Data: info,
@@ -759,7 +760,7 @@ func (s *StreamAllocator) handleSignalSendProbe(event Event) {
}
func (s *StreamAllocator) handleSignalProbeClusterDone(event Event) {
info, _ := event.Data.(ProbeClusterInfo)
info, _ := event.Data.(ccutils.ProbeClusterInfo)
s.probeController.ProbeClusterDone(info)
}
@@ -1409,23 +1410,28 @@ func (s *StreamAllocator) initProbe(probeGoalDeltaBps int64) {
expectedBandwidthUsage := s.getExpectedBandwidthUsage()
probeClusterId, probeGoalBps := s.probeController.InitProbe(probeGoalDeltaBps, expectedBandwidthUsage)
channelState := ""
if s.channelObserver != nil {
channelState = s.channelObserver.ToString()
}
s.channelObserver = s.newChannelObserverProbe()
s.channelObserver.SeedEstimate(s.lastReceivedEstimate)
s.params.Logger.Debugw(
"stream allocator: starting probe",
logFields := []any{
"probeClusterId", probeClusterId,
"current usage", expectedBandwidthUsage,
"committed", s.committedChannelCapacity,
"lastReceived", s.lastReceivedEstimate,
"channel", channelState,
"probeGoalDeltaBps", probeGoalDeltaBps,
"goalBps", probeGoalBps,
)
}
if s.sendSideBWE != nil {
channelState := ""
if s.channelObserver != nil {
channelState = s.channelObserver.ToString()
}
s.channelObserver = s.newChannelObserverProbe()
s.channelObserver.SeedEstimate(s.lastReceivedEstimate)
logFields = append(
logFields,
"lastReceived", s.lastReceivedEstimate,
"channel", channelState,
)
}
s.params.Logger.Debugw("stream allocator: starting probe", logFields...)
}
func (s *StreamAllocator) maybeProbe() {