[asterisk-dev] Optimizing ast_generic_bridge

Imran Ahmed codentest at gmail.com
Thu May 11 00:11:27 MST 2006


Hi,

On analyzing the ast_generic_bridge function in channel.c
It uses ast_waitfor() to monitor the two channels in a bridge.
Since ast_waitfor() generates only one winner out of the
two channels, even though both channels might have data
waiting in them (that means an extra call to ast_waitfor()
should be made to find out that other channel had data too).
I agree that this might not be true in all situations, but atleast
in some situations this extra call can be avoided.

One possible way is to not generate a winner but
to return the results of the poll on both the channels.
Since ast_waitfor is used in many other parts another
function can be added that explicitly returns the poll
results rather than a winner.
In the ideal case this can save almost 50 poll calls per sec per bridge
(assuming 20ms frames)

If some of you approve this change, I am more than willing to
submit a patch to this effect.

Thanks
Imran



More information about the asterisk-dev mailing list