* [FFmpeg-devel] [PATCH] avcodec/libjxldec: goto SUCCESS when frame is completed (PR #21278)
@ 2025-12-23 3:18 Jack Lau via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Jack Lau via ffmpeg-devel @ 2025-12-23 3:18 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Jack Lau
PR #21278 opened by Jack Lau (JackLau)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21278
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21278.patch
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 <jacklau1222gm@gmail.com>
>From fedb4b905d7adb495aa65bc37cf11aa6153464bf Mon Sep 17 00:00:00 2001
From: Jack Lau <jacklau1222gm@gmail.com>
Date: Tue, 23 Dec 2025 10:53:23 +0800
Subject: [PATCH] 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 <jacklau1222gm@gmail.com>
---
libavcodec/libjxldec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index a43437fb10..2aada927b4 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;
}
@@ -584,6 +583,7 @@ static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame)
continue;
}
case JXL_DEC_SUCCESS:
+success:
av_log(avctx, AV_LOG_DEBUG, "SUCCESS event emitted\n");
/*
* this event will be fired when the zero-length EOF
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-23 3:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-23 3:18 [FFmpeg-devel] [PATCH] avcodec/libjxldec: goto SUCCESS when frame is completed (PR #21278) Jack Lau via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git