summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorgestoip2 <gestoip2@ull.edu.es>2016-11-11 14:16:50 +0000
committerRichard Mudgett <rmudgett@digium.com>2016-11-22 21:20:17 -0600
commit8756ce64b7874dbcc0cd9a47aa09fc21cb4f9f81 (patch)
tree1f091339bd4b09a3b4632629c2e0fe2b1e8cd1d2 /main
parent425da14927f10205911f5db6d6b193b22203c224 (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')
-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 051253103..5c7b7a07b 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1987,7 +1987,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",