[Asterisk-cvs] asterisk/channels chan_iax2.c,1.114,1.115

markster at lists.digium.com markster at lists.digium.com
Thu Mar 25 02:20:41 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv21894/channels

Modified Files:
	chan_iax2.c 
Log Message:
Make sure calculation of time is always > 0...


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- chan_iax2.c	23 Mar 2004 21:42:35 -0000	1.114
+++ chan_iax2.c	25 Mar 2004 07:17:33 -0000	1.115
@@ -2578,7 +2578,7 @@
 static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, struct timeval *delivery)
 {
 	struct timeval tv;
-	unsigned int ms;
+	int ms;
 	if (!p->offset.tv_sec && !p->offset.tv_usec) {
 		gettimeofday(&p->offset, NULL);
 		/* Round to nearest 20ms */
@@ -2592,6 +2592,8 @@
 	} else {
 		gettimeofday(&tv, NULL);
 		ms = (tv.tv_sec - p->offset.tv_sec) * 1000 + (tv.tv_usec - p->offset.tv_usec) / 1000;
+		if (ms < 0)
+			ms = 0;
 	}
 	/* We never send the same timestamp twice, so fudge a little if we must */
 	if (ms <= p->lastsent) {
@@ -2632,7 +2634,7 @@
 {
 	/* Returns where in "receive time" we are */
 	struct timeval tv;
-	unsigned int ms;
+	int ms;
 	/* Setup rxcore if necessary */
 	if (!p->rxcore.tv_sec && !p->rxcore.tv_usec)
 		gettimeofday(&p->rxcore, NULL);




More information about the svn-commits mailing list