Do not calculate distance if max layers are not valid (#1515)

This commit is contained in:
Raja Subramanian
2023-03-14 15:19:50 +05:30
committed by GitHub
parent 75eb0e01ec
commit e0495f6cab
+4 -4
View File
@@ -306,6 +306,10 @@ done:
}
}
if !maxLayers.IsValid() || s.maxTemporalLayerSeen < 0 {
return 0.0
}
distance := float64(0.0)
for sp := maxLayers.Spatial; sp <= s.getMaxExpectedLayerLocked(); sp++ {
for t := maxLayers.Temporal; t <= s.maxTemporalLayerSeen; t++ {
@@ -313,10 +317,6 @@ done:
}
}
if s.maxTemporalLayerSeen < 0 {
return distance
}
return distance / float64(s.maxTemporalLayerSeen+1)
}