From: Russell Bryant Date: Tue, 28 Nov 2006 23:13:37 +0000 (+0000) Subject: Add a comment to note near some code that performs a very expensive operation X-Git-Tag: 1.6.0-beta1~3^2~3841 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c16c606cffd19b19720e0e0966a87050ed5bf7e3;p=thirdparty%2Fasterisk.git Add a comment to note near some code that performs a very expensive operation that occurs for every incoming media frame. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48099 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index f7cdcb2891..78bf747c52 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1195,6 +1195,20 @@ static int make_trunk(unsigned short callno, int locked) return res; } +/*! + * \todo XXX Note that this function contains a very expensive operation that + * happens for *every* incoming media frame. It iterates through every + * possible call number, locking and unlocking each one, to try to match the + * incoming frame to an active call. Call numbers can be up to 2^15, 32768. + * So, for an call with a local call number of 20000, every incoming audio + * frame would require 20000 mutex lock and unlock operations. Ouch. + * + * It's a shame that IAX2 media frames carry the source call number instead of + * the destination call number. If they did, this lookup wouldn't be needed. + * However, it's too late to change that now. Instead, we need to come up with + * a better way of indexing active calls so that these frequent lookups are not + * so expensive. + */ static int find_callno(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int lockpeer, int sockfd) { int res = 0;