diff --git a/src/switch_estimators.c b/src/switch_estimators.c index 2aedf8cc6e..61552644b1 100644 --- a/src/switch_estimators.c +++ b/src/switch_estimators.c @@ -139,7 +139,7 @@ SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t * return TRUE; } -SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float rtt_avg) +SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float avg) { float K=0; float P=0; @@ -153,8 +153,8 @@ SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_de detector->N++; current_average = detector->last_average + (measurement - detector->last_average)/detector->N ; - if (rtt_avg > current_average) { - current_average = rtt_avg; + if (avg > current_average) { + current_average = avg; } current_q = detector-> last_q + (measurement - detector->last_average) * (measurement - current_average); if (detector->N != 0) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 199c9e95f7..aa25ea1c79 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1953,7 +1953,7 @@ static void rtcp_stats_init(switch_rtp_t *rtp_session) rtp_session->detectors[EST_RTT] = switch_core_alloc(rtp_session->pool, sizeof(*detectors[0])); switch_kalman_cusum_init(rtp_session->detectors[EST_RTT],0.005,0.5); rtp_session->detectors[EST_LOSS] = switch_core_alloc(rtp_session->pool, sizeof(*detectors[0])); - switch_kalman_cusum_init(rtp_session->detectors[EST_LOSS],0.005,0.5); + switch_kalman_cusum_init(rtp_session->detectors[EST_LOSS], 0.5, 1); } }