[asterisk-dev] dvossel: branch 1.6.1 r205218 - in /branches/1.6.1: ./ include/asterisk/time.h

Tony Mountifield tony at softins.clara.co.uk
Thu Jul 9 04:38:13 CDT 2009


In article <E1MOaRM-0001dY-EJ at wibble.digium.internal>,
SVN commits to the Digium repositories <svn-commits at lists.digium.com> wrote:
> Author: dvossel
> Date: Wed Jul  8 11:56:13 2009
> New Revision: 205218
> 
> URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205218
> Log:
> Merged revisions 205216 via svnmerge from 
> https://origsvn.digium.com/svn/asterisk/trunk
> 
> ................
>   r205216 | dvossel | 2009-07-08 11:54:24 -0500 (Wed, 08 Jul 2009) | 17 lines
>   
>   Merged revisions 205215 via svnmerge from 
>   https://origsvn.digium.com/svn/asterisk/branches/1.4
>   
>   ........
>     r205215 | dvossel | 2009-07-08 11:53:40 -0500 (Wed, 08 Jul 2009) | 10 lines
>     
>     ast_samp2tv needs floating point for 16khz audio
>     
>     In ast_samp2tv(), (1000000 / _rate) = 62.5 when _rate is 16000.
>     The .5 is currently stripped off because we don't calculate
>     using floating points.  This causes madness with 16khz audio.
>     
>     (issue ABE-1899)
>     
>     Review: https://reviewboard.asterisk.org/r/305/
>   ........
> ................
> 
> Modified:
>     branches/1.6.1/   (props changed)
>     branches/1.6.1/include/asterisk/time.h
> 
> Propchange: branches/1.6.1/
> ------------------------------------------------------------------------------
> Binary property 'trunk-merged' - no diff available.
> 
> Modified: branches/1.6.1/include/asterisk/time.h
> URL:
> http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/include/asterisk/time.h?view=diff&rev=205218&r1=205217&r2=205218
> ==============================================================================
> --- branches/1.6.1/include/asterisk/time.h (original)
> +++ branches/1.6.1/include/asterisk/time.h Wed Jul  8 11:56:13 2009
> @@ -171,7 +171,7 @@
>  AST_INLINE_API(
>  struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate),
>  {
> -	return ast_tv(_nsamp / _rate, (_nsamp % _rate) * (1000000 / _rate));
> +	return ast_tv(_nsamp / _rate, (_nsamp % _rate) * (1000000 / (float) _rate));

This can easily be done without using floating point:

return ast_tv(_nsamp / _rate, ((_nsamp % _rate) * (2000000 / _rate))/2);

Or if you want to support up to say 32000Hz sample rate for the future:

return ast_tv(_nsamp / _rate, ((_nsamp % _rate) * (4000000 / _rate))/4);

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-dev mailing list