[asterisk-dev] [svn-commits] seanbright: branch 1.8 r355746 - /branches/1.8/channels/chan_iax2.c

Tilghman Lesher tilghman at meg.abyt.es
Fri Feb 17 15:49:42 CST 2012


On Fri, Feb 17, 2012 at 2:46 PM, Richard Mudgett <rmudgett at digium.com> wrote:
>> Author: seanbright
>> Date: Fri Feb 17 13:32:52 2012
>> New Revision: 355746
>>
>> URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=355746
>> Log:
>> Pass the correct value to ast_timer_set_rate() for IAX2 trunking.
>>
>> IAX2 uses the trunkfreq variable to determine how often to send trunk
>> packets, but
>> this value is in milliseconds while ast_timer_set_rate() expects the
>> rate argument
>> to be ticks per second.  So we divide 1000 by trunkfreq and pass that
>> in instead.
>>
>> With a default of 20ms, this change makes IAX2 send trunk packets
>> every 20ms
>> instead of every 50ms.
>>
>> Modified:
>>     branches/1.8/channels/chan_iax2.c
>>
>> Modified: branches/1.8/channels/chan_iax2.c
>> URL:
>> http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_iax2.c?view=diff&rev=355746&r1=355745&r2=355746
>> ==============================================================================
>> --- branches/1.8/channels/chan_iax2.c (original)
>> +++ branches/1.8/channels/chan_iax2.c Fri Feb 17 13:32:52 2012
>> @@ -14716,7 +14716,7 @@
>>       jb_setoutput(jb_error_output, jb_warning_output, NULL);
>>
>>       if ((timer = ast_timer_open())) {
>> -             ast_timer_set_rate(timer, trunkfreq);
>> +             ast_timer_set_rate(timer, 1000 / trunkfreq);
>
> I think this should be
>   trunkfreq / 1000
> if you want to convert from milliseconds to seconds.

He's not converting from milliseconds to seconds.  He's converting
from milliseconds to ticks per second.  Since he's flipping the time
unit from the top to the bottom of the fraction, his calculation is
correct.



More information about the asterisk-dev mailing list