[FFmpeg-devel] [PATCH v2 1/2] avcodec/avpacket: Always treat dst in av_packet_ref as uninitialized

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat Mar 28 06:09:30 EET 2020


Anton Khirnov:
> Quoting Andreas Rheinhardt (2020-03-27 03:25:13)
>> av_packet_ref() mostly treated the destination packet dst as uninitialized,
>> i.e. the destination fields were simply overwritten. But if the source
>> packet was not reference-counted, dst->buf was treated as if it pointed
>> to an already allocated buffer (if != NULL) to be reallocated to the
>> desired size.
>>
>> The documentation did not explicitly state whether the dst will be treated
>> as uninitialized, but it stated that if the source packet is not refcounted,
>> a new buffer in dst will be allocated. This and the fact that the side-data
>> as well as the codepath taken in case src is refcounted always treated the
>> packet as uninitialized means that dst should always be treated as
>> uninitialized for the sake of consistency. And this behaviour has been
>> explicitly documented.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
>> ---
>>  libavcodec/avcodec.h  | 2 +-
>>  libavcodec/avpacket.c | 1 +
>>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> ok
> 
Applied, thanks.

- Andreas


More information about the ffmpeg-devel mailing list