[FFmpeg-cvslog] avcodec/h264dec: Properly mark frames as recovered when draining

arch1t3cht git at videolan.org
Tue Apr 16 18:48:18 EEST 2024


ffmpeg | branch: master | arch1t3cht <arch1t3cht at gmail.com> | Thu Mar 28 02:56:37 2024 +0100| [5a856ac6e6a627402c1ff57a92fc478efb601131] | committer: Derek Buitenhuis

avcodec/h264dec: Properly mark frames as recovered when draining

When decoding starts at a SEI recovery point very shortly before the
end of the video stream, there can be frames which are decoded before
the recovery point's frame is output and which will only be output once
the draining has started. Previously, these frames would never be set
as recovered. This commit copies the logic from h264_select_output_frame
to send_next_delayed_frame to properly mark such frames as recovered.

Fixes ticket #10936.

Signed-off-by: arch1t3cht <arch1t3cht at gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a856ac6e6a627402c1ff57a92fc478efb601131
---

 libavcodec/h264dec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 727dc1a662..567f0dfa6b 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1014,6 +1014,9 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame,
         h->delayed_pic[i] = h->delayed_pic[i + 1];
 
     if (out) {
+        h->frame_recovered |= out->recovered;
+        out->recovered |= h->frame_recovered & FRAME_RECOVERED_SEI;
+
         out->reference &= ~DELAYED_PIC_REF;
         ret = finalize_frame(h, dst_frame, out, got_frame);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list