Less confusing variable name (#2706)

This commit is contained in:
Raja Subramanian
2024-05-08 16:10:49 +05:30
committed by GitHub
parent 9a5db132eb
commit 71b5ffed93
+7 -7
View File
@@ -124,18 +124,18 @@ func (w *windowStat) calculatePacketScore(plw float64, includeRTT bool, includeJ
return score return score
} }
func (w *windowStat) calculateBitrateScore(expectedBitrate int64, isEnabled bool) float64 { func (w *windowStat) calculateBitrateScore(expectedBits int64, isEnabled bool) float64 {
if expectedBitrate == 0 || !isEnabled { if expectedBits == 0 || !isEnabled {
// unsupported mode OR all layers stopped // unsupported mode OR all layers stopped
return cMaxScore return cMaxScore
} }
var score float64 var score float64
if w.bytes != 0 { if w.bytes != 0 {
// using the ratio of expectedBitrate / actualBitrate // using the ratio of expectedBits / actualBits
// the quality inflection points are approximately // the quality inflection points are approximately
// GOOD at ~2.7x, POOR at ~20.1x // 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 { if score > cMaxScore {
score = cMaxScore score = cMaxScore
} }
@@ -369,7 +369,7 @@ func (q *qualityScorer) AddLayerTransition(distance float64) {
func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) { func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) {
// always update transitions // always update transitions
expectedBitrate, _, err := q.aggregateBitrate.GetAggregateAndRestartAt(at) expectedBits, _, err := q.aggregateBitrate.GetAggregateAndRestartAt(at)
if err != nil { if err != nil {
q.params.Logger.Warnw("error getting expected bitrate", err) q.params.Logger.Warnw("error getting expected bitrate", err)
} }
@@ -405,7 +405,7 @@ func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) {
} }
} else { } else {
packetScore := stat.calculatePacketScore(plw, q.params.IncludeRTT, q.params.IncludeJitter) 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) layerScore := math.Max(math.Min(cMaxScore, cMaxScore-(expectedDistance*distanceWeight)), 0.0)
minScore := math.Min(packetScore, bitrateScore) minScore := math.Min(packetScore, bitrateScore)
@@ -451,7 +451,7 @@ func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) {
"stat", stat, "stat", stat,
"packetLossWeight", plw, "packetLossWeight", plw,
"maxPPS", q.maxPPS, "maxPPS", q.maxPPS,
"expectedBitrate", expectedBitrate, "expectedBits", expectedBits,
"expectedDistance", expectedDistance, "expectedDistance", expectedDistance,
) )
} }