[asterisk-dev] ast_frame allocation/free question

Simon Perreault simon.perreault at viagenie.ca
Tue Nov 27 15:09:39 CST 2007


On Tuesday 27 November 2007 15:42:22 Kevin P. Fleming wrote:
> Because the channel driver has *ZERO* input into whether the frame is
> still needed or not; the channel API explicitly defines that a frame of
> data passed to it is NOT consumed. If the channel driver were to consume
> it, then you wouldn't be able to write the frame to two places (for
> example) without copying it.

Ok, so if I understand correctly, one of two things must happen when I call 
ast_write() from my application:

1) The channel makes a copy of the frame for sending later, and takes charge 
of freeing the copy.

2) ast_write() is synchronous and the frame is no longer needed once it 
returns.

Which is it?

Either I'm getting it all wrong, or I have an even bigger problem than I first 
thought. And my code is largely inspired from Sergio's on sip.fontventa.com 
so we'd be two. ;)



More information about the asterisk-dev mailing list