Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: DE-AI via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: DE-AI <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] vc1_parser: Reset unesc_index after extracting header with complete frames (PR #20445)
Message-ID: <175708608999.25.17336891912565755547@463a07221176> (raw)

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 <max.christoph@pentaxmedical.com>


>From 9be0b59b547db94670319cf0073645d32dd2615c Mon Sep 17 00:00:00 2001
From: DE-AI <max.christoph@pentaxmedical.com>
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 <max.christoph@pentaxmedical.com>
---
 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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-09-05 15:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=175708608999.25.17336891912565755547@463a07221176 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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