From 71b5ffed9380abb9d2766e6e5f1c52e4d056754b Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Wed, 8 May 2024 16:10:49 +0530 Subject: [PATCH] Less confusing variable name (#2706) --- pkg/sfu/connectionquality/scorer.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/sfu/connectionquality/scorer.go b/pkg/sfu/connectionquality/scorer.go index facef770a..7364e3dc3 100644 --- a/pkg/sfu/connectionquality/scorer.go +++ b/pkg/sfu/connectionquality/scorer.go @@ -124,18 +124,18 @@ func (w *windowStat) calculatePacketScore(plw float64, includeRTT bool, includeJ return score } -func (w *windowStat) calculateBitrateScore(expectedBitrate int64, isEnabled bool) float64 { - if expectedBitrate == 0 || !isEnabled { +func (w *windowStat) calculateBitrateScore(expectedBits int64, isEnabled bool) float64 { + if expectedBits == 0 || !isEnabled { // unsupported mode OR all layers stopped return cMaxScore } var score float64 if w.bytes != 0 { - // using the ratio of expectedBitrate / actualBitrate + // using the ratio of expectedBits / actualBits // the quality inflection points are approximately // GOOD at ~2.7x, POOR at ~20.1x - score = cMaxScore - 20*math.Log(float64(expectedBitrate)/float64(w.bytes*8)) + score = cMaxScore - 20*math.Log(float64(expectedBits)/float64(w.bytes*8)) if score > cMaxScore { score = cMaxScore } @@ -369,7 +369,7 @@ func (q *qualityScorer) AddLayerTransition(distance float64) { func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) { // always update transitions - expectedBitrate, _, err := q.aggregateBitrate.GetAggregateAndRestartAt(at) + expectedBits, _, err := q.aggregateBitrate.GetAggregateAndRestartAt(at) if err != nil { q.params.Logger.Warnw("error getting expected bitrate", err) } @@ -405,7 +405,7 @@ func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) { } } else { packetScore := stat.calculatePacketScore(plw, q.params.IncludeRTT, q.params.IncludeJitter) - bitrateScore := stat.calculateBitrateScore(expectedBitrate, q.params.EnableBitrateScore) + bitrateScore := stat.calculateBitrateScore(expectedBits, q.params.EnableBitrateScore) layerScore := math.Max(math.Min(cMaxScore, cMaxScore-(expectedDistance*distanceWeight)), 0.0) minScore := math.Min(packetScore, bitrateScore) @@ -451,7 +451,7 @@ func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) { "stat", stat, "packetLossWeight", plw, "maxPPS", q.maxPPS, - "expectedBitrate", expectedBitrate, + "expectedBits", expectedBits, "expectedDistance", expectedDistance, ) }