Stop forwarding on congestion (#429)

* WIP commit

* comment out debug stuff
This commit is contained in:
Raja Subramanian
2022-02-11 09:17:53 +05:30
committed by GitHub
parent 8680f6fd23
commit a6338992e8
7 changed files with 37 additions and 19 deletions
+14 -6
View File
@@ -365,7 +365,7 @@ func (s *StreamAllocator) handleEvent(event *Event) {
func (s *StreamAllocator) handleSignalAddTrack(event *Event) {
params, _ := event.Data.(AddTrackParams)
isManaged := (params.Source != livekit.TrackSource_SCREEN_SHARE && params.Source != livekit.TrackSource_SCREEN_SHARE_AUDIO) || params.IsSimulcast
track := newTrack(event.DownTrack, isManaged)
track := newTrack(event.DownTrack, isManaged, s.params.Logger)
trackID := livekit.TrackID(event.DownTrack.ID())
switch event.DownTrack.Kind() {
@@ -518,7 +518,7 @@ func (s *StreamAllocator) handleSignalTargetBitrate(event *Event) {
s.receivedEstimate = int64(receivedEstimate)
/*
if s.prevReceivedEstimate != s.receivedEstimate {
s.params.Logger.Debugw("received new estimate",
s.params.Logger.Debugw("received new send side estimate",
"old(bps)", s.prevReceivedEstimate,
"new(bps)", s.receivedEstimate,
)
@@ -1073,6 +1073,7 @@ func (s *StreamStateUpdate) Empty() bool {
type Track struct {
downTrack *DownTrack
isManaged bool
logger logger.Logger
highestSN uint32
packetsLost uint32
@@ -1082,10 +1083,11 @@ type Track struct {
maxLayers VideoLayers
}
func newTrack(downTrack *DownTrack, isManaged bool) *Track {
func newTrack(downTrack *DownTrack, isManaged bool, logger logger.Logger) *Track {
t := &Track{
downTrack: downTrack,
isManaged: isManaged,
logger: logger,
}
t.UpdateMaxLayers(downTrack.MaxLayers())
@@ -1136,7 +1138,9 @@ func (t *Track) WritePaddingRTP(bytesToSend int) int {
}
func (t *Track) Allocate(availableChannelCapacity int64, allowPause bool) VideoAllocation {
return t.downTrack.Allocate(availableChannelCapacity, allowPause)
allocation := t.downTrack.Allocate(availableChannelCapacity, allowPause)
//t.logger.Debugw("SA_DEBUG Capacity allocation", "available", availableChannelCapacity, "alloc", allocation) // REMOVE
return allocation
}
func (t *Track) ProvisionalAllocatePrepare() {
@@ -1156,11 +1160,15 @@ func (t *Track) ProvisionalAllocateGetBestWeightedTransition() VideoTransition {
}
func (t *Track) ProvisionalAllocateCommit() VideoAllocation {
return t.downTrack.ProvisionalAllocateCommit()
allocation := t.downTrack.ProvisionalAllocateCommit()
//t.logger.Debugw("SA_DEBUG Provisional commit", "alloc", allocation) // REMOVE
return allocation
}
func (t *Track) AllocateNextHigher() (VideoAllocation, bool) {
return t.downTrack.AllocateNextHigher()
allocation, boosted := t.downTrack.AllocateNextHigher()
//t.logger.Debugw("SA_DEBUG Probe next higher layer", "alloc", allocation, "boosted", boosted) // REMOVE
return allocation, boosted
}
func (t *Track) FinalizeAllocate() {