Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: wangyaqiang via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: 汪亚强 <wangyaqiang03@kuaishou.com>, 1035567130@qq.com
Subject: [FFmpeg-devel] [PATCH] libavformat/matroskadec: fix the pos value error in the packet
Date: Thu, 26 Feb 2026 20:44:50 +0800
Message-ID: <tencent_8009C428CE559D0F6D0831195645ED71EB05@qq.com> (raw)

From: 汪亚强 <wangyaqiang03@kuaishou.com>

When parsing a block, the passed data corresponds to the pos value.
However, when constructing a packet, some offsets are made to the data,
so the pos in the packet does not correspond to the position in the file.

Signed-off-by: 汪亚强 <wangyaqiang03@kuaishou.com>
---
 libavformat/matroskadec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 503b99b286..0215855019 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -4116,7 +4116,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf
     int n, flags, laces = 0;
     uint64_t num;
     int trust_default_duration;
-
+    uint8_t *data_start = data;
     av_assert1(buf);
 
     ffio_init_read_context(&pb, data, size);
@@ -4200,7 +4200,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf
     if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
         track->end_timecode =
             FFMAX(track->end_timecode, timecode + block_duration);
-
+    pos += (data - data_start);
     for (n = 0; n < laces; n++) {
         int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
         uint8_t *out_data = data;
-- 
2.50.1 (Apple Git-155)

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

             reply	other threads:[~2026-02-26 12:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 12:44 wangyaqiang via ffmpeg-devel [this message]
2026-02-26 12:55 ` [FFmpeg-devel] " Patchwork via ffmpeg-devel
2026-02-26 12:58 [FFmpeg-devel] " wangyaqiang via ffmpeg-devel
2026-02-26 13:48 wangyaqiang via ffmpeg-devel
2026-02-27  3:16 wangyaqiang via ffmpeg-devel

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=tencent_8009C428CE559D0F6D0831195645ED71EB05@qq.com \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=1035567130@qq.com \
    --cc=wangyaqiang03@kuaishou.com \
    /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