[asterisk-commits] file: branch russell/frame_caching r38609 -
/team/russell/frame_caching/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Jul 31 12:51:06 MST 2006
Author: file
Date: Mon Jul 31 14:51:06 2006
New Revision: 38609
URL: http://svn.digium.com/view/asterisk?rev=38609&view=rev
Log:
Minor optimization. Instead of checking every frame in the queue to see if it's a hangup, just check the last one since no further frames will have been queued after it.
Modified:
team/russell/frame_caching/channel.c
Modified: team/russell/frame_caching/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/frame_caching/channel.c?rev=38609&r1=38608&r2=38609&view=diff
==============================================================================
--- team/russell/frame_caching/channel.c (original)
+++ team/russell/frame_caching/channel.c Mon Jul 31 14:51:06 2006
@@ -721,15 +721,19 @@
return -1;
}
ast_channel_lock(chan);
+
+ /* See if the last frame on the queue is a hangup, if so don't queue anything */
+ if ((cur = AST_LIST_LAST(&chan->readq)) && (cur->frametype == AST_FRAME_CONTROL) && (cur->subclass == AST_CONTROL_HANGUP)) {
+ ast_frfree(f);
+ ast_channel_unlock(chan);
+ return 0;
+ }
+
+ /* Count how many frames exist on the queue */
AST_LIST_TRAVERSE(&chan->readq, cur, frame_list) {
- if ((cur->frametype == AST_FRAME_CONTROL) && (cur->subclass == AST_CONTROL_HANGUP)) {
- /* Don't bother actually queueing anything after a hangup */
- ast_frfree(f);
- ast_channel_unlock(chan);
- return 0;
- }
qlen++;
}
+
/* Allow up to 96 voice frames outstanding, and up to 128 total frames */
if (((fin->frametype == AST_FRAME_VOICE) && (qlen > 96)) || (qlen > 128)) {
if (fin->frametype != AST_FRAME_VOICE) {
More information about the asterisk-commits
mailing list