From: Russell Bryant Date: Tue, 17 Mar 2009 15:22:12 +0000 (+0000) Subject: Tweak the handling of the frame list inside of ast_answer(). X-Git-Tag: 11.0.0-beta1~5229 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d6ba51d054d2010f73c806ee47e90c9277ffca1;p=thirdparty%2Fasterisk.git Tweak the handling of the frame list inside of ast_answer(). This does not change any behavior, but moves the frames from the local frame list back to the channel read queue using an O(n) algorithm instead of O(n^2). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182553 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/channel.c b/main/channel.c index 8f90dcc293..782629312a 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1801,7 +1801,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer) ast_frfree(cur); } - AST_LIST_INSERT_TAIL(&frames, new, frame_list); + AST_LIST_INSERT_HEAD(&frames, new, frame_list); /* if a specific delay period was requested, continue * until that delay has passed. don't stop just because @@ -1837,8 +1837,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer) if (res == 0) { ast_channel_lock(chan); - while ((cur = AST_LIST_LAST(&frames))) { - AST_LIST_REMOVE(&frames, cur, frame_list); + while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { ast_queue_frame_head(chan, cur); ast_frfree(cur); }