[Libav-user] Video buffer padding

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Oct 25 01:23:27 CEST 2012


Tony Glover <T.Glover at ...> writes:

> You should set aside enough buffer space to hold 
> your data AND the extra padding to it and ensure that 
> the extra padding is set to zero. Something like this 
> would suffice :-
> 
> If you have copied the incoming data to your buffer, 
> e.g memcpy(mPkt->data, data, dataSize);
> Then you should pad it thus - memset(mPkt->data + 
> mPkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);

I don't think this is correct / accurate.
The point of the padding is not that you add 0's to 
the pkt->size number of bytes of your input data, 
but that you make sure that the buffer that contains 
the number of bytes is FF_INPUT_BUFFER_PADDING_SIZE 
larger than pkt->size (ie was allocated with at least 
pkt->size + FF_INPUT_BUFFER_PADDING_SIZE).

Please do not top-post here, Carl Eugen



More information about the Libav-user mailing list