Fix connection quality in constrained up stream (#1521)

A few things
1. Have to use expected layer in upstream distance to desired. Using
min(published, expected) means if expected is higher than published, it was not caught as a missed layer.
2. Forgot to remove layer transition update in one place. It was still constrained to screen share.
This caused quality to not pick up after constraint is released.
3. Switching to max layer cannot be marked on max published. Same as point #1 above. Otherwise,
dynacast would kick in and turn off highest layer.
This commit is contained in:
Raja Subramanian
2023-03-15 13:27:27 +05:30
committed by GitHub
parent 5bef98dc2a
commit 582adda97c
3 changed files with 20 additions and 12 deletions
+10 -5
View File
@@ -286,7 +286,7 @@ func (s *StreamTrackerManager) DistanceToDesired() float64 {
s.lock.RLock()
defer s.lock.RUnlock()
if s.paused {
if s.paused || s.maxExpectedLayer < 0 || s.maxTemporalLayerSeen < 0 {
return 0
}
@@ -306,13 +306,18 @@ done:
}
}
if !maxLayers.IsValid() || s.maxTemporalLayerSeen < 0 {
return 0.0
adjustedMaxLayers := maxLayers
if !maxLayers.IsValid() {
adjustedMaxLayers = VideoLayers{Spatial: 0, Temporal: 0}
}
distance :=
((s.getMaxExpectedLayerLocked() - maxLayers.Spatial) * (s.maxTemporalLayerSeen + 1)) +
(s.maxTemporalLayerSeen - maxLayers.Temporal)
((s.maxExpectedLayer - adjustedMaxLayers.Spatial) * (s.maxTemporalLayerSeen + 1)) +
(s.maxTemporalLayerSeen - adjustedMaxLayers.Temporal)
if !maxLayers.IsValid() {
distance++
}
return float64(distance) / float64(s.maxTemporalLayerSeen+1)
}