mirror of
https://github.com/livekit/livekit.git
synced 2026-09-01 20:09:08 +00:00
ConnectionQuality DISCONNECTED -> LOST (#2276)
This commit is contained in:
@@ -259,7 +259,7 @@ func TestConnectionQuality(t *testing.T) {
|
||||
require.Greater(t, float32(4.6), mos)
|
||||
require.Equal(t, livekit.ConnectionQuality_EXCELLENT, quality)
|
||||
|
||||
// next update with no packets should knock quality down to DISCONNECTED
|
||||
// next update with no packets should knock quality down to LOST
|
||||
now = now.Add(duration)
|
||||
trp.setStreams(map[uint32]*buffer.StreamStatsWithLayers{
|
||||
1: {
|
||||
@@ -273,14 +273,14 @@ func TestConnectionQuality(t *testing.T) {
|
||||
cs.updateScoreAt(now.Add(duration))
|
||||
mos, quality = cs.GetScoreAndQuality()
|
||||
require.Greater(t, float32(2.1), mos)
|
||||
require.Equal(t, livekit.ConnectionQuality_DISCONNECTED, quality)
|
||||
require.Equal(t, livekit.ConnectionQuality_LOST, quality)
|
||||
|
||||
// mute when DISCONNECTED should not bump up score/quality
|
||||
// mute when LOST should not bump up score/quality
|
||||
now = now.Add(duration)
|
||||
cs.UpdateMuteAt(true, now.Add(1*time.Second))
|
||||
mos, quality = cs.GetScoreAndQuality()
|
||||
require.Greater(t, float32(2.1), mos)
|
||||
require.Equal(t, livekit.ConnectionQuality_DISCONNECTED, quality)
|
||||
require.Equal(t, livekit.ConnectionQuality_LOST, quality)
|
||||
|
||||
// unmute and send packets to bring quality back up
|
||||
now = now.Add(duration)
|
||||
|
||||
@@ -43,9 +43,9 @@ const (
|
||||
|
||||
var (
|
||||
qualityTransitionScore = map[livekit.ConnectionQuality]float64{
|
||||
livekit.ConnectionQuality_GOOD: 80,
|
||||
livekit.ConnectionQuality_POOR: 40,
|
||||
livekit.ConnectionQuality_DISCONNECTED: 20,
|
||||
livekit.ConnectionQuality_GOOD: 80,
|
||||
livekit.ConnectionQuality_POOR: 40,
|
||||
livekit.ConnectionQuality_LOST: 20,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -227,8 +227,8 @@ func (q *qualityScorer) Start() {
|
||||
func (q *qualityScorer) updateMuteAtLocked(isMuted bool, at time.Time) {
|
||||
if isMuted {
|
||||
q.mutedAt = at
|
||||
// muting when DISCONNECTED should not push quality to EXCELLENT
|
||||
if q.score != qualityTransitionScore[livekit.ConnectionQuality_DISCONNECTED] {
|
||||
// muting when LOST should not push quality to EXCELLENT
|
||||
if q.score != qualityTransitionScore[livekit.ConnectionQuality_LOST] {
|
||||
q.score = cMaxScore
|
||||
}
|
||||
} else {
|
||||
@@ -376,7 +376,7 @@ func (q *qualityScorer) updateAtLocked(stat *windowStat, at time.Time) {
|
||||
var score float64
|
||||
if stat.packetsExpected == 0 {
|
||||
reason = "dry"
|
||||
score = qualityTransitionScore[livekit.ConnectionQuality_DISCONNECTED]
|
||||
score = qualityTransitionScore[livekit.ConnectionQuality_LOST]
|
||||
} else {
|
||||
packetScore := stat.calculatePacketScore(plw, q.params.IncludeRTT, q.params.IncludeJitter)
|
||||
bitrateScore := stat.calculateBitrateScore(expectedBitrate)
|
||||
@@ -543,11 +543,11 @@ func scoreToConnectionQuality(score float64) livekit.ConnectionQuality {
|
||||
return livekit.ConnectionQuality_GOOD
|
||||
}
|
||||
|
||||
if score > qualityTransitionScore[livekit.ConnectionQuality_DISCONNECTED] {
|
||||
if score > qualityTransitionScore[livekit.ConnectionQuality_LOST] {
|
||||
return livekit.ConnectionQuality_POOR
|
||||
}
|
||||
|
||||
return livekit.ConnectionQuality_DISCONNECTED
|
||||
return livekit.ConnectionQuality_LOST
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user