From: Steve K. <st...@st...> - 2004-02-20 23:11:25
|
Iaxclient-developers, We just fixed a bug we found in libiax2, which caused it to never send full voice frames. The basic problem is that the logic to check to see if we should send a full frame basically looks to see if the top half of the timestamp has changed, but it wasn't using the timestamp of the previous frame for the comparison, it was using the timestamp of the current frame. Therefore, the top half will always be equal, and full frames will never be sent. I'm not sure how this affects some of the problems that people were having with transferred calls, but it causes havoc to the jitterbuffer mechanism on asterisk servers. This will likely screw up any calls to an asterisk server which has the jitterbuffer enabled (which is no longer the default, but seems pretty important for most internet calls). The patch is below, and has been committed to sourceforge CVS. Mark: Please also apply this to digium libiax2 CVS if it looks correct to you. -SteveK Log Message: calc_timestamp modifies pvt->lastsent. Therefore, the next test is always true, (since ts will == lastsent), and we'll never send full audio frames. If we don't send full audio frames, we quickly screw up the jitterbuffer mechanism on the receiving asterisk server, because the timestamp wraps, and nothing ever corrects it. This fix follows the way this section of code works in chan_iax2.c -SK/JO Index: iax.c =================================================================== RCS file: /cvsroot/iaxclient/iaxclient/lib/libiax2/src/iax.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- iax.c 13 Feb 2004 22:20:01 -0000 1.13 +++ iax.c 20 Feb 2004 22:26:51 -0000 1.14 @@ -631,9 +631,12 @@ return -1; } + /* this must come before the next call to calc_timestamp() since + calc_timestamp() will change lastsent to the returned value */ + lastsent = pvt->lastsent; + /* Calculate actual timestamp */ fts = calc_timestamp(pvt, ts); - lastsent = pvt->lastsent; if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && |