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 221d52b commit 066dc50
Showing 1 changed file with 5 additions and 0 deletions.
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 066dc50

Please sign in to comment.