diff mbox series

[FFmpeg-devel,1/3] avcodec/h264dec: Properly mark frames as recovered when draining

Message ID 20240328015639.1425494-2-arch1t3cht@gmail.com
State Accepted
Commit 5a856ac6e6a627402c1ff57a92fc478efb601131
Headers show
Series avcodec/h264dec: Fix dropped frames when draining | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

arch1t3cht March 28, 2024, 1:56 a.m. UTC
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@gmail.com>
---
 libavcodec/h264dec.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index b4973fce29..8503ea018a 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1013,6 +1013,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)