diff --git a/pkg/gcc/loss_based_bwe.go b/pkg/gcc/loss_based_bwe.go index e1443947..d2b315ec 100644 --- a/pkg/gcc/loss_based_bwe.go +++ b/pkg/gcc/loss_based_bwe.go @@ -2,6 +2,7 @@ package gcc import ( "github.com/pion/interceptor/internal/types" + "github.com/pion/logging" ) type lossBasedBandwidthEstimator struct { @@ -9,6 +10,7 @@ type lossBasedBandwidthEstimator struct { averageLoss float64 inertia float64 decay float64 + log logging.LeveledLogger } func newLossBasedBWE() *lossBasedBandwidthEstimator { @@ -17,6 +19,7 @@ func newLossBasedBWE() *lossBasedBandwidthEstimator { decay: 0.5, bitrate: 0, averageLoss: 0, + log: logging.NewDefaultLoggerFactory().NewLogger("gcc_loss_controller"), } } @@ -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)