fix(gateway): qualify stepped impairment throughput
This commit is contained in:
@@ -1187,8 +1187,17 @@ func runQualificationImpairment(t *testing.T, profile qualificationImpairmentPro
|
||||
observation.ObservedLossPercent = float64(observation.Dropped) * 100 / float64(packetCount)
|
||||
observation.ObservedReorderPercent = float64(observation.ObservedOutOfOrder) * 100 / float64(packetCount)
|
||||
if packetCount >= qualificationImpairmentPacketCount {
|
||||
lowerThroughput := float64(media.BitrateKbps) * (1 - profile.LossPercent/100) * 0.90
|
||||
upperThroughput := float64(media.BitrateKbps) * 1.05
|
||||
capacityFactor := 1.0
|
||||
if len(profile.CapacitySteps) > 0 {
|
||||
inverseRates := 1.0
|
||||
for _, reduction := range profile.CapacitySteps {
|
||||
inverseRates += 100 / float64(100-reduction)
|
||||
}
|
||||
capacityFactor = float64(len(profile.CapacitySteps)+1) / inverseRates
|
||||
}
|
||||
expectedThroughput := float64(media.BitrateKbps) * (1 - profile.LossPercent/100) * capacityFactor
|
||||
lowerThroughput := expectedThroughput * 0.90
|
||||
upperThroughput := expectedThroughput * 1.05
|
||||
if observation.ObservedThroughputKbps < lowerThroughput || observation.ObservedThroughputKbps > upperThroughput {
|
||||
return qualificationImpairmentObservation{}, fmt.Errorf("observed throughput %.2f outside [%.2f,%.2f]", observation.ObservedThroughputKbps, lowerThroughput, upperThroughput)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user