]> git.sesse.net Git - ffmpeg/commit
avcodec/avpacket: Always treat dst in av_packet_ref as uninitialized
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 12 Feb 2020 11:18:23 +0000 (12:18 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 28 Mar 2020 02:54:48 +0000 (03:54 +0100)
commite621f2b6cd95a69db637d0ed979cf9e614b58cac
tree3f4eff2af4490919179f89eda036fdf0451ff3cb
parent26a36801c0496ec0975af1b7af3ced220aa2aa18
avcodec/avpacket: Always treat dst in av_packet_ref as uninitialized

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@gmail.com>
libavcodec/avcodec.h
libavcodec/avpacket.c