1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avcodec/decode: fetch packets from the pkt_props FIFO on every frame returned

Fixes memleaks on decoders that don't call ff_decode_frame_props(), like
libdav1d.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2021-06-18 17:58:18 -03:00
parent 05f9b3a0a5
commit a4fb03563a

View File

@@ -533,6 +533,10 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
if (ret == AVERROR_EOF)
avci->draining_done = 1;
if (IS_EMPTY(avci->last_pkt_props) && av_fifo_size(avci->pkt_props) >= sizeof(*avci->last_pkt_props))
av_fifo_generic_read(avci->pkt_props,
avci->last_pkt_props, sizeof(*avci->last_pkt_props), NULL);
if (!ret) {
frame->best_effort_timestamp = guess_correct_pts(avctx,
frame->pts,
@@ -1490,10 +1494,6 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
{ AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE },
};
if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >= sizeof(*pkt))
av_fifo_generic_read(avctx->internal->pkt_props,
pkt, sizeof(*pkt), NULL);
frame->pts = pkt->pts;
frame->pkt_pos = pkt->pos;
frame->pkt_duration = pkt->duration;