]> git.sesse.net Git - ffmpeg/commit
avformat/matroskadec: Reuse AVFormatInternal.parse_pkt
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 18 Mar 2021 05:04:17 +0000 (06:04 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 23 Mar 2021 23:07:36 +0000 (00:07 +0100)
commita4d036965dac42e7a7b50c6038c928d008655282
tree2374b07de6d249660742fae7920675d5ed2ea8b5
parentadff25412a2929de67e44da1abaf67f9a267bdf4
avformat/matroskadec: Reuse AVFormatInternal.parse_pkt

Before 8d78e90a6ba96646f7f25aff6ca3e12e71cec164 the Matroska demuxer
used stack packets to hold temporary packets; now it uses a temporary
packet allocated by the Matroska demuxer. Yet because it used stack
packets the code has always properly reset the packet on error, while
on success these temporary packets were put into a packet list via
avpriv_packet_list_put(), which already resets the source packet.
This means that this code is compatible with just reusing
AVFormatInternal.parse_pkt (which is unused while one is in the
demuxer's read_packet() function). Compared to before 8d78e90a6
this no longer wastes one initialization per AVPacket read
(the resetting of the stack packet performed by av_packet_move_ref()
in avpriv_packet_list_put() was for naught).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/internal.h
libavformat/matroskadec.c