[Asterisk-cvs] asterisk/channels chan_iax2.c,1.321,1.322

kpfleming at lists.digium.com kpfleming at lists.digium.com
Wed Jul 20 18:39:44 CDT 2005


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

Modified Files:
	chan_iax2.c 
Log Message:
_really_ fix IAX2 crazy timestamp problem (bug #4747)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.321
retrieving revision 1.322
diff -u -d -r1.321 -r1.322
--- chan_iax2.c	19 Jul 2005 23:17:02 -0000	1.321
+++ chan_iax2.c	20 Jul 2005 22:46:58 -0000	1.322
@@ -3380,6 +3380,7 @@
 	int ms;
 	int voice = 0;
 	int genuine = 0;
+	int adjust;
 	struct timeval *delivery = NULL;
 
 
@@ -3421,8 +3422,15 @@
 			if (p->notsilenttx && abs(ms - p->nextpred) <= MAX_TIMESTAMP_SKEW) {
 				/* Adjust our txcore, keeping voice and 
 					non-voice synchronized */
-				p->offset = ast_tvadd(p->offset,
-						ast_samp2tv((ms - p->nextpred)/10, 1000)); /* XXX what scale is this ??? */
+				/* We need someone who understands this code to comment here on
+				   why the 'adjust' value is handled as if it was in units
+				   of 10,000 microseconds, instead of milliseconds
+				*/
+				adjust = (ms - p->nextpred);
+				if (adjust < 0)
+					p->offset = ast_tvsub(p->offset, ast_samp2tv(abs(adjust), 10000));
+				else if (adjust > 0)
+					p->offset = ast_tvadd(p->offset, ast_samp2tv(adjust, 10000));
 
 				if (!p->nextpred) {
 					p->nextpred = ms; /*f->samples / 8;*/




More information about the svn-commits mailing list