The branch, master has been updated
       via  1dcb0c6c3e0e461362c7f2f4d05ea117699ec6bd (commit)
      from  74e61981b5fe7c08b398dd59b8570e87e53ceb2e (commit)


- Log -----------------------------------------------------------------
commit 1dcb0c6c3e0e461362c7f2f4d05ea117699ec6bd
Author:     Leo Izen <[email protected]>
AuthorDate: Wed Aug 27 11:53:23 2025 -0400
Commit:     Leo Izen <[email protected]>
CommitDate: Sat Sep 6 15:51:41 2025 -0400

    avcodec/libjxldec: consume input on error
    
    libjxl consumes no input if it returns an error, so this loops over
    and over while it spits out the same error many times. If we got an
    error from libjxl and consumed no input, then we instead consume the
    whole packet.
    
    Signed-off-by: Leo Izen <[email protected]>

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index d0f0015c90..650cc6e5c0 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -414,12 +414,20 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
          * the number of bytes that it did read
          */
         remaining = JxlDecoderReleaseInput(ctx->decoder);
-        pkt->data += pkt->size - remaining;
+        size_t consumed = pkt->size - remaining;
+        pkt->data += consumed;
         pkt->size = remaining;
 
         switch(jret) {
         case JXL_DEC_ERROR:
             av_log(avctx, AV_LOG_ERROR, "Unknown libjxl decode error\n");
+            /*
+             * we consume all remaining input on error, if nothing was consumed
+             * this prevents libjxl from consuming nothing forever
+             * and just dumping the last error over and over
+             */
+            if (!consumed)
+                av_packet_unref(pkt);
             return AVERROR_INVALIDDATA;
         case JXL_DEC_NEED_MORE_INPUT:
             av_log(avctx, AV_LOG_DEBUG, "NEED_MORE_INPUT event emitted\n");

-----------------------------------------------------------------------

Summary of changes:
 libavcodec/libjxldec.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)


hooks/post-receive
-- 

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

Reply via email to