mirror of
https://github.com/livekit/livekit.git
synced 2026-08-27 22:34:25 +00:00
Less confusing variable name (#2706)
This commit is contained in:
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user