summaryrefslogtreecommitdiff
path: root/main/rtp_engine.c
diff options
context:
space:
mode:
authorgestoip2 <gestoip2@ull.edu.es>2016-11-11 14:16:50 +0000
committerRichard Mudgett <rmudgett@digium.com>2016-11-23 11:15:42 -0500
commitd9b24cce0add96061a0b1e0f135b3148789af5ac (patch)
treecf1736a7018d54c221273754d4e3111374a294c1 /main/rtp_engine.c
parent038158bf7b5d450c5d712248a334c596b723ff3f (diff)
res_rtp_asterisk: RTT miscalculation in RTCP
When retrieving RTCP stats for PJSIP channels, RTT values are unreliable. RTT calculation is correct, but the data representation isn't. RTT is represented by a 32-bit fixed-point number with the integer part in the first 16 bits and the fractional part in the last 16 bits. In order to get the RTT value, the fractional part is miscalculated, there is an unnecessary 16 bit shift that causes overflow. Besides this there is another mistake, when transforming the integer value to the fixed point fractional part via bitwise operation, that loses precision. * RTT fractional part is no longer shifted, avoiding overflow. * RTT fractional part is transformed to its fixed-point value more precisely. * Fixed timeval2ntp() and ntp2timeval() second fraction conversions. * Fixed NTP timestamp report logging. The usec was inexplicably multiplied by 4096. ASTERISK-26566 #close Reported by Hector Royo Concepcion Change-Id: Ie09bdabfee75afb3f1b8ddfd963e5219ada3b96f
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r--main/rtp_engine.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 4fc1414f0..3ef2d876b 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -2493,7 +2493,7 @@ static struct ast_manager_event_blob *rtcp_report_to_ami(struct stasis_message *
if (type == AST_RTP_RTCP_SR) {
ast_str_append(&packet_string, 0, "SentNTP: %lu.%06lu\r\n",
(unsigned long)payload->report->sender_information.ntp_timestamp.tv_sec,
- (unsigned long)payload->report->sender_information.ntp_timestamp.tv_usec * 4096);
+ (unsigned long)payload->report->sender_information.ntp_timestamp.tv_usec);
ast_str_append(&packet_string, 0, "SentRTP: %u\r\n",
payload->report->sender_information.rtp_timestamp);
ast_str_append(&packet_string, 0, "SentPackets: %u\r\n",