avcodec/decode: use a packet list to store packet properties

Keeping only the latest packet fed to the decoder works only for decoders that
return a frame immediately after every consumed packet. Decoders that consume
several packets before they return a frame will fill said frame with properties
taken from the last consumed packet instead of the earliest.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-08-17 12:06:55 -03:00
parent 8a81820624
commit 022a12b306
3 changed files with 32 additions and 9 deletions

View file

@ -50,6 +50,7 @@
#include "thread.h"
#include "frame_thread_encoder.h"
#include "internal.h"
#include "packet_internal.h"
#include "put_bits.h"
#include "raw.h"
#include "bytestream.h"
@ -1149,6 +1150,8 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_packet_free(&avctx->internal->compat_encode_packet);
av_packet_free(&avctx->internal->buffer_pkt);
av_packet_free(&avctx->internal->last_pkt_props);
avpriv_packet_list_free(&avctx->internal->pkt_props,
&avctx->internal->pkt_props_tail);
av_packet_free(&avctx->internal->ds.in_pkt);
av_frame_free(&avctx->internal->es.in_frame);