[asterisk-commits] mjordan: branch 12 r422766 - /branches/12/main/rtp_engine.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 6 17:20:30 CDT 2014


Author: mjordan
Date: Sat Sep  6 17:20:27 2014
New Revision: 422766

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=422766
Log:
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.

Modified:
    branches/12/main/rtp_engine.c

Modified: branches/12/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/rtp_engine.c?view=diff&rev=422766&r1=422765&r2=422766
==============================================================================
--- branches/12/main/rtp_engine.c (original)
+++ branches/12/main/rtp_engine.c Sat Sep  6 17:20:27 2014
@@ -1876,8 +1876,8 @@
 	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,




More information about the asterisk-commits mailing list