[asterisk-dev] [Code Review] remove empty audiohook write list on channel

David Vossel dvossel at digium.com
Fri Jul 23 13:07:12 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/799/
-----------------------------------------------------------

Review request for Asterisk Developers.


Summary
-------

If a channel has an audiohook write list created on it, that list stays on the channel until the channel is destroyed.  There is no reason to keep that list on the channel if it becomes empty.  If it is empty that just means we are doing needless translating for every ast_read and ast_write.  This patch removes the audiohook list from the channel once it is detected to be empty on either a read or write.  If a audiohook is added back to the channel after this list is destroyed, the list just gets recreated as if it never existed to begin with.


Diffs
-----

  /trunk/include/asterisk/audiohook.h 278690 
  /trunk/main/audiohook.c 278690 
  /trunk/main/channel.c 278690 

Diff: https://reviewboard.asterisk.org/r/799/diff


Testing
-------

I tested this using chanspy.  I verified that when a channel is spying on another channel, that once the spy hangs up the audiohook list on the other channel is freed. I then verified that once that audiohook list is freed it can get recreated on the same channel by spying on it again before hanging up.


Thanks,

David




More information about the asterisk-dev mailing list