]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11201 Fix 'rtt_valid = 0;' was incorrectly placed rendering whole RTT thing void.
authorSergey Khripchenko <shripchenko@intermedia.net>
Tue, 28 Aug 2018 12:12:53 +0000 (05:12 -0700)
committerMike Jerris <mike@jerris.com>
Thu, 30 Aug 2018 22:58:20 +0000 (22:58 +0000)
+ 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.

src/switch_rtp.c

index b25a68e43bc4899d6a7e088ccffd6287760abaa9..96075bae7c2e28e985a696645acd07e7b5b62db3 100644 (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);