From: Matthew Jordan Date: Sat, 6 Sep 2014 22:22:34 +0000 (+0000) Subject: main/rtp_engine: Format NTP timestamps as unsigned ints X-Git-Tag: 14.0.0-beta1~1678 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4591f98b1235789c7341abb26ec52dd79d6090f;p=thirdparty%2Fasterisk.git 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. ........ Merged revisions 422766 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 422767 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422768 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/rtp_engine.c b/main/rtp_engine.c index 0c624ab616..a63819f633 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -1931,8 +1931,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,