[asterisk-dev] f->offset - How should it be used ?

Kevin P. Fleming kpfleming at digium.com
Wed Apr 19 08:51:41 MST 2006


Jacob Tinning wrote:
> I have a question about the offset field in the frame structure.
> It seems to me that to read the data from a frame, I need these three fields:
> 
> 1. f->data
> 2. f->datalen
> 3. f->offset

The offset tells you how many bytes exist in the buffer _prior_ to the
data, and are not included in datalen.

> or Do I start from f->data and read f->datalen bytes ?

Yes. 'offset' is there in case you need to place some data ahead of the
actual frame contents (RTP headers, for example), in which case you can
decrement 'data' and increment 'datalen' by the amount of data you place
in the buffer ahead of the normal contents.



More information about the asterisk-dev mailing list