[Asterisk-Users] Re: [asterisk-dev] No audio? Update your Asterisk

Luigi Rizzo rizzo at icir.org
Wed Jan 25 05:31:01 MST 2006


On Wed, Jan 25, 2006 at 10:59:00AM +0100, Olle E Johansson wrote:
> This morning we discovered a serious bug that stopped all bridged audio 
> in our Asterisk servers. Mark found the problem and soon fixed it.
> 
> If you get this problem today, please update your Asterisk server. A fix 
> has been commited to the subversion repository for 1.2 as well as trunk.
> 
> A fixed 1.2.3 release will be published on ftp.digium.com as soon as we 
> can find a release engineer (consider the time zone problem).
> 
> A big thank you to everyone in the IRC channel that helped us locate 
> this issue and to Mark that fixed it so quickly.

a good way to identify these bugs would be to change
ast_timediff_ms() to log values that are clearly out
of range, and return a properly saturated value
in those cases.
Code below - i have no web access at the moment,
but tried it and it spotted the bug before it was fixed.
(adding code to print a backtrace would even
point straight to the list of offending calls,
i have code for that as well if someone is interested).

cheers
luigi

AST_INLINE_API(
int ast_tvdiff_ms(struct timeval end, struct timeval start),
{
	/* the offset by 1,000,000 below is intentional...
	   it avoids differences in the way that division
	   is handled for positive and negative numbers, by ensuring
	   that the divisor is always positive
	*/
	int a = end.tv_sec - start.tv_sec;
	const int lim = 1<<21; /* max 21 bits, so the *1000 scaling will still fit in a 32-bit int */
	if (a > lim || a < -lim) {
		ast_log(LOG_WARNING, "tvdiff too large, saturating %d\n", a);
		a = (a > lim) ? lim : -lim;
	}
	return  (a * 1000) +
		(((1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000);
}
)
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev




More information about the asterisk-users mailing list