Skip to content

Commit

Permalink
Log average loss on update
Browse files Browse the repository at this point in the history
  • Loading branch information
mengelbart committed Nov 23, 2021
1 parent eb2eee7 commit f0a0339
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ adamroach <[email protected]>
aler9 <[email protected]>
Antoine Baché <[email protected]>
Atsushi Watanabe <[email protected]>
boks1971 <[email protected]>
Jonathan Müller <[email protected]>
Mathis Engelbart <[email protected]>
Sean DuBois <[email protected]>
5 changes: 5 additions & 0 deletions pkg/gcc/loss_based_bwe.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package gcc

import (
"github.com/pion/interceptor/internal/types"
"github.com/pion/logging"
)

type lossBasedBandwidthEstimator struct {
bitrate types.DataRate
averageLoss float64
inertia float64
decay float64
log logging.LeveledLogger
}

func newLossBasedBWE() *lossBasedBandwidthEstimator {
Expand All @@ -17,6 +19,7 @@ func newLossBasedBWE() *lossBasedBandwidthEstimator {
decay: 0.5,
bitrate: 0,
averageLoss: 0,
log: logging.NewDefaultLoggerFactory().NewLogger("gcc_loss_controller"),
}
}

Expand All @@ -39,6 +42,8 @@ func (e *lossBasedBandwidthEstimator) updateLossStats(results []types.PacketResu
lossRatio := float64(packetsLost) / float64(len(results))
e.averageLoss = e.inertia*lossRatio + e.decay*(1-e.inertia)*e.averageLoss

e.log.Infof("averageLoss: %v", e.averageLoss)

// Naive implementation using constants from IETF Draft
// TODO(mathis): Make this more smart and configurable. (Smart here means
// don't decrease too often and such things, see libwebrtc)
Expand Down

0 comments on commit f0a0339

Please sign in to comment.