Browse code

rtpengine: ignore mos 0 when selecting min-mos (#2771)

and computing average mos

Julien Chavanton authored on 10/06/2021 12:03:13 • GitHub committed on 10/06/2021 12:03:13
Showing 1 changed files
... ...
@@ -3588,13 +3588,15 @@ ssrc_ok:
3588 3588
 			continue;
3589 3589
 
3590 3590
 		if (decode_mos_vals_dict(&vals_decoded, ssrc_dict, "average MOS")) {
3591
-			average_vals.avg_samples++;
3592
-			average_vals.mos += vals_decoded.mos;
3593
-			average_vals.packetloss += vals_decoded.packetloss;
3594
-			average_vals.jitter += vals_decoded.jitter;
3595
-			average_vals.roundtrip += vals_decoded.roundtrip;
3596
-			average_vals.roundtrip_leg += vals_decoded.roundtrip_leg;
3597
-			average_vals.samples += vals_decoded.samples;
3591
+			if (vals_decoded.mos > 0) {
3592
+				average_vals.avg_samples++;
3593
+				average_vals.mos += vals_decoded.mos;
3594
+				average_vals.packetloss += vals_decoded.packetloss;
3595
+				average_vals.jitter += vals_decoded.jitter;
3596
+				average_vals.roundtrip += vals_decoded.roundtrip;
3597
+				average_vals.roundtrip_leg += vals_decoded.roundtrip_leg;
3598
+				average_vals.samples += vals_decoded.samples;
3599
+			}
3598 3600
 		}
3599 3601
 
3600 3602
 		if (decode_mos_vals_dict(&vals_decoded, ssrc_dict, "highest MOS")) {
... ...
@@ -3602,7 +3604,7 @@ ssrc_ok:
3602 3604
 				max_vals = vals_decoded;
3603 3605
 		}
3604 3606
 		if (decode_mos_vals_dict(&vals_decoded, ssrc_dict, "lowest MOS")) {
3605
-			if (vals_decoded.mos < min_vals.mos)
3607
+			if (vals_decoded.mos > 0 && vals_decoded.mos < min_vals.mos)
3606 3608
 				min_vals = vals_decoded;
3607 3609
 		}
3608 3610
 	}