From 6a701d2d8ff40fe1fb66fda2951eb4f8f100341d Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Sat, 6 Sep 2014 22:20:27 +0000 Subject: [PATCH] main/rtp_engine: Format NTP timestamps as unsigned ints On some systems, a timeval's tv_sec/tv_usec will be unsigned lont ints, as opposed to long ints. When the RTP engine formats these as strings, it was previously formatting them as signed integers, which can result in some odd negative timestamp values (particularly on 32-bit systems). This patch formats the values as unsigned long integers. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@422766 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/rtp_engine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/rtp_engine.c b/main/rtp_engine.c index 7a73f985ad..5fcf077544 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -1876,8 +1876,8 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg, if (payload->report->type == AST_RTP_RTCP_SR) { char sec[32]; char usec[32]; - snprintf(sec, sizeof(sec), "%ld", payload->report->sender_information.ntp_timestamp.tv_sec); - snprintf(usec, sizeof(usec), "%ld", payload->report->sender_information.ntp_timestamp.tv_usec); + snprintf(sec, sizeof(sec), "%lu", payload->report->sender_information.ntp_timestamp.tv_sec); + snprintf(usec, sizeof(usec), "%lu", payload->report->sender_information.ntp_timestamp.tv_usec); json_rtcp_sender_info = ast_json_pack("{s: s, s: s, s: i, s: i, s: i}", "ntp_timestamp_sec", sec, "ntp_timestamp_usec", usec, -- 2.47.2