PR #26218 opened by Pu Cheng (GeekQAQ) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26218 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26218.patch
hevc_frame_end() clears sei.picture_hash.is_md5 after verifying the decoded picture hash, but returns early when the verification fails and err_recognition contains AV_EF_EXPLODE, leaving is_md5 and the MD5 of that frame set. hevc_decode_flush() does not clear it either, so after avcodec_flush_buffers() the next frame without a picture hash SEI (for example the first frame of another stream) is verified against the previous stream's MD5 and avcodec_send_packet() fails. Clear is_md5 on that path as well. Signed-off-by: Pu Cheng <[email protected]> >From 8be983448a8178928b7c6bf4494bee445f04b924 Mon Sep 17 00:00:00 2001 From: Pu Cheng <[email protected]> Date: Fri, 20 Nov 2026 14:08:21 +0800 Subject: [PATCH] avcodec/hevc/hevcdec: clear the picture hash when MD5 verification fails hevc_frame_end() clears sei.picture_hash.is_md5 after verifying the decoded picture hash, but returns early when the verification fails and err_recognition contains AV_EF_EXPLODE, leaving is_md5 and the MD5 of that frame set. hevc_decode_flush() does not clear it either, so after avcodec_flush_buffers() the next frame without a picture hash SEI (for example the first frame of another stream) is verified against the previous stream's MD5 and avcodec_send_packet() fails. Clear is_md5 on that path as well. Signed-off-by: Pu Cheng <[email protected]> --- libavcodec/hevc/hevcdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index be7b1a91bb4..77311b58f66 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -4351,8 +4351,10 @@ static int hevc_frame_end(HEVCContext *s, HEVCLayerContext *l) if (s->avctx->err_recognition & AV_EF_CRCCHECK && s->sei.picture_hash.is_md5) { ret = verify_md5(s, out->f); - if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE) + if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE) { + s->sei.picture_hash.is_md5 = 0; return ret; + } } } s->sei.picture_hash.is_md5 = 0; -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
