Commit e1a65fe178 for ffmpeg
commit e1a65fe178280b196b40688eb90b72d7eb63f2f9
Author: Julius Bairaktaris <julius@bairaktaris.de>
Date: Mon Sep 28 07:29:03 2026 +0200
avcodec/av1dec: take the discard flag from the packet that shows a frame
A frame coded with show_frame=0 takes AV_FRAME_FLAG_DISCARD from the
packet that coded it. When show_existing_frame outputs it from a packet
that is not discarded, the frame is still dropped. Take the flag from
the showing packet, as is already done for pts and pkt_dts. MP4 edit
lists and the trim bsf's preroll option produce such discarded leading
packets.
Assisted-by: Claude Opus 5.5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 6e15590193..5f06dd1467 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -1171,6 +1171,10 @@ static int set_output_frame(AVCodecContext *avctx, AVFrame *frame)
frame->pts = pkt->pts;
frame->pkt_dts = pkt->dts;
+ if (pkt->flags & AV_PKT_FLAG_DISCARD)
+ frame->flags |= AV_FRAME_FLAG_DISCARD;
+ else
+ frame->flags &= ~AV_FRAME_FLAG_DISCARD;
av_packet_unref(pkt);