]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 182553 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Tue, 17 Mar 2009 15:31:14 +0000 (15:31 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 17 Mar 2009 15:31:14 +0000 (15:31 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
r182553 | russell | 2009-03-17 10:22:12 -0500 (Tue, 17 Mar 2009) | 5 lines

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/branches/1.6.1@182570 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 699d49568847c83f72e6ed584258b17665df730a..bfdcee894435d49176a7ad1c0ae101955d55889d 100644 (file)
@@ -1776,7 +1776,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
@@ -1812,8 +1812,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);
                                }