PR #25026 opened by Forgejo_Fairy
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25026
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25026.patch

LLM-GPT-6-ASTRA investigation of #24379 found that the existing warning does 
not distinguish a forward timestamp outside the Block’s signed 16-bit range 
from a delayed packet that forces a backward Cluster timestamp jump.

Include the direction, stream index, incoming timestamp, current Cluster 
timestamp, and signed difference in milliseconds. For the supplied reproducer, 
the first warning identifies stream 7, timestamp 3000 ms, current Cluster 
timestamp 55168 ms, and delta -52168 ms.

This addresses the diagnostic part of #24379. Packet interleaving and exit 
status remain unchanged; the scheduling problem remains open.

Validation on Linux/AArch64 with GCC 13.3.0:

- Reproduced both backward warnings with the issue’s synthetic bundle.
- Exercised the forward warning with subtitle cues at 0 and 40 seconds and 
`-cluster_time_limit 1000000`.
- Compared baseline and patched outputs: identical physical packet order, 
timestamps, durations, and SHA-256 packet payload hashes.
- `make fate-matroska SAMPLES=/opt/fate-suite` passed the single test enabled 
by the minimal build, `matroska-spherical-mono`.
- `git diff --check` passed.


From 73d7957b3691412f64a2e1128f8b5b270417b0a7 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Mon, 12 Oct 2026 13:10:15 +0000
Subject: [PATCH] avformat/matroskaenc: describe timestamp jumps when starting
 a cluster

The existing warning does not distinguish a forward timestamp outside the
Block's signed 16-bit range from a late packet that forces a backward
Cluster timestamp jump. Include the direction, stream index, incoming
timestamp, current Cluster timestamp and signed difference in milliseconds.

This addresses the diagnostic part of issue #24379. It does not change
packet interleaving or turn the condition into a muxing error.

Assisted-by: Fairy
---
 libavformat/matroskaenc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f278271e24..a8408da8c1 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3148,7 +3148,12 @@ static int mkv_write_packet_internal(AVFormatContext *s, 
const AVPacket *pkt)
             ret = mkv_end_cluster(s);
             if (ret < 0)
                 return ret;
-            av_log(s, AV_LOG_WARNING, "Starting new cluster due to 
timestamp\n");
+            av_log(s, AV_LOG_WARNING,
+                   "Starting new cluster due to %s timestamp jump in stream 
%d: "
+                   "timestamp %"PRId64" ms, current cluster timestamp %"PRId64
+                   " ms, delta %"PRId64" ms outside the signed 16-bit range\n",
+                   cluster_time < 0 ? "backward" : "forward", 
pkt->stream_index,
+                   ts, mkv->cluster_pts, cluster_time);
         }
     }
 
-- 
2.52.0

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

Reply via email to