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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 13c91c97d1 avcodec/libjxldec: goto SUCCESS when frame is completed
13c91c97d1 is described below

commit 13c91c97d12a28750f572c87cf13934456845df1
Author:     Jack Lau <[email protected]>
AuthorDate: Tue Dec 23 10:53:23 2025 +0800
Commit:     James Almer <[email protected]>
CommitDate: Wed Dec 24 02:43:50 2025 +0000

    avcodec/libjxldec: goto SUCCESS when frame is completed
    
    Fix #21260
    
    The early code didn't reset the JxlDecoder. If the
    caller re-send the same packet to JxlDecoder after
    avcodec_flush_buffers() (free ctx->frame). It will
    directly hit SUCCESS event (skip all EVENTs).
    
    In this case, the ctx->frame already flushed by
    avcodec_flush_buffers, so the received frame
    will be invalid (has no private_ref) that causes
    assertion in decode_receive_frame_internal().
    
    MPV meet this issue because it seek the jxl image
    (second read the same pkt) when it does crop
    through config `C vf toggle crop=in_w:in_w/2.4`.
    
    This patch make sure hit the entire SUCCESS event
    (contains reset the JxlDecoder) when frame_complete
    is true.
    
    Signed-off-by: Jack Lau <[email protected]>
---
 libavcodec/libjxldec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index a43437fb10..a2f125998e 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -450,9 +450,8 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
                     av_log(avctx, AV_LOG_ERROR, "Unexpected end of JXL 
codestream\n");
                     return AVERROR_INVALIDDATA;
                 } else if (ctx->frame_complete) {
-                    libjxl_finalize_frame(avctx, frame, ctx->frame);
                     ctx->jret = JXL_DEC_SUCCESS;
-                    return 0;
+                    goto success;
                 }
                 return AVERROR_EOF;
             }
@@ -591,6 +590,7 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
              * but it will also be fired when the next image of
              * an image2pipe sequence is loaded up
              */
+success:
             libjxl_finalize_frame(avctx, frame, ctx->frame);
             JxlDecoderReset(ctx->decoder);
             libjxl_init_jxl_decoder(avctx);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to