From: David Vossel Date: Wed, 8 Jul 2009 16:53:40 +0000 (+0000) Subject: ast_samp2tv needs floating point for 16khz audio X-Git-Tag: 1.4.26-rc6~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f4c452028a0d696c3092537cf3574fa2f65d404;p=thirdparty%2Fasterisk.git 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@205215 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/time.h b/include/asterisk/time.h index 92a5346a5a..306ea7ffb0 100644 --- a/include/asterisk/time.h +++ b/include/asterisk/time.h @@ -137,7 +137,7 @@ struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec), 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)); } )