This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 6705ef6df69bee020de53d17eb1406d77e785623
Author:     Lynne <[email protected]>
AuthorDate: Thu Jul 30 18:16:58 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Sun Sep 20 11:59:22 2026 +0900

    h264: give frame num gap dummies the duplicated picture's hwaccel state and 
POCs
    
    The dummies created for gaps in frame_num duplicate the previous
    reference's frame, but kept their own freshly-allocated
    hwaccel_picture_private and their field POCs at INT_MAX. Hardware
    decoders locate reference pictures through hwaccel_picture_private and
    order them by the field POCs, so predicting from a dummy read
    unrelated or uninitialized memory, and streams with lost frames
    decoded to garbage from the first gap onwards.
    
    Carry the duplicated picture's hwaccel state over to the dummy, which
    also keeps it valid after the duplicated picture leaves the DPB, and
    give the dummy sane field POCs.
---
 libavcodec/h264_slice.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c303cb33c1..ba832f8aaf 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1575,7 +1575,18 @@ static int h264_field_start(H264Context *h, const 
H264SliceContext *sl,
                 if (ret < 0)
                     return ret;
                 h->short_ref[0]->poc = prev->poc + 2U;
+                /* The frame POC is all hwaccels see; leaving the field POCs
+                 * at their INT_MAX init value breaks their reference
+                 * ordering. */
+                h->short_ref[0]->field_poc[0] = h->short_ref[0]->poc;
+                h->short_ref[0]->field_poc[1] = h->short_ref[0]->poc;
                 h->short_ref[0]->gray = prev->gray;
+                /* Hardware decoders keep DPB state (e.g. separate reference
+                 * images) in hwaccel_picture_private; carry the duplicated
+                 * picture's over so references to the dummy read its pixels,
+                 * even after the duplicated picture leaves the DPB. */
+                av_refstruct_replace(&h->short_ref[0]->hwaccel_picture_private,
+                                     prev->hwaccel_picture_private);
                 ff_thread_report_progress(&h->short_ref[0]->tf, INT_MAX, 0);
                 if (h->short_ref[0]->field_picture)
                     ff_thread_report_progress(&h->short_ref[0]->tf, INT_MAX, 
1);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to