FS-11201 Fix 'rtt_valid = 0;' was incorrectly placed rendering whole RTT thing void.

+ don't shoot in a leg and keep 'rtt_now' value correct (even if we clear it few lines after), because after some time it could be changed.
This commit is contained in:
Sergey Khripchenko 2018-08-28 05:12:53 -07:00 committed by Mike Jerris
parent 91e9633ce1
commit 25682d619c
1 changed files with 3 additions and 3 deletions

View File

@ -6613,7 +6613,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
switch_time_exp_gmt(&now_hr,now);
/* Calculating RTT = A - DLSR - LSR */
rtt_now = (double)(lsr_now - rtp_session->rtcp_frame.reports[i].dlsr - rtp_session->rtcp_frame.reports[i].lsr)/65536;
rtt_now = ((double)(((int64_t)lsr_now) - rtp_session->rtcp_frame.reports[i].dlsr - rtp_session->rtcp_frame.reports[i].lsr))/65536;
/* Only account RTT if it didn't overflow. */
if (lsr_now > rtp_session->rtcp_frame.reports[i].dlsr + rtp_session->rtcp_frame.reports[i].lsr) {
@ -6641,10 +6641,10 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
rtp_session->rtcp_frame.reports[i].ssrc, rtt_now,
lsr_now, rtp_session->rtcp_frame.reports[i].dlsr, rtp_session->rtcp_frame.reports[i].lsr);
#endif
rtt_valid = 0;
rtt_now = 0;
}
rtt_valid = 0;
rtt_now = 0;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "RTT average %f\n",
rtp_session->rtcp_frame.reports[i].rtt_avg);