PR #20445 opened by DE-AI
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20445
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20445.patch

When PARSER_FLAG_COMPLETE_FRAMES is set (e.g. in Matroska),
unesc_index is not reset after the first frame, which causes
subsequent frames to inherit leftover header data.

This leads to incorrect keyframe marking and broken decoding.

See also this bug report: https://trac.ffmpeg.org/ticket/8515

Signed-off-by: DE-AI <[email protected]>


>From 9be0b59b547db94670319cf0073645d32dd2615c Mon Sep 17 00:00:00 2001
From: DE-AI <[email protected]>
Date: Fri, 5 Sep 2025 15:27:01 +0000
Subject: [PATCH] vc1_parser: Reset unesc_index after extracting header with
 complete frames

When PARSER_FLAG_COMPLETE_FRAMES is set (e.g. in Matroska),
unesc_index is not reset after the first frame, which causes
subsequent frames to inherit leftover header data.

This leads to incorrect keyframe marking and broken decoding.

See also this bug report: https://trac.ffmpeg.org/ticket/8515

Signed-off-by: DE-AI <[email protected]>
---
 libavcodec/vc1_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index a536a7bcf8..124a7a771f 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -179,6 +179,7 @@ static int vc1_parse(AVCodecParserContext *s,
             // start codes if we know it contains a complete frame and
             // we've already unescaped all we need of the frame header
             vc1_extract_header(s, avctx, unesc_buffer, unesc_index);
+            unesc_index = 0;
             break;
         }
         if (unesc_index >= UNESCAPED_THRESHOLD && !start_code_found) {
-- 
2.49.1

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

Reply via email to