Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] fftools/ffmpeg_sched: make trailing_dts() report max_dts instead of min_dts (PR #21770)
@ 2026-02-16 17:10 ngaullier via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: ngaullier via ffmpeg-devel @ 2026-02-16 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: ngaullier

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

This is to reapply 18217bb0f5fb4ad9d93ea02edab078111cd83910.
Its commit msg is still meaningful:
"Using the max instead of the min avoids the progress stopping
with gaps in sparse streams (subtitles)."

Unfortunately, the comment "compute min output value" was left
unchanged in this commit and this was pretty misleading...
So, years later, the 'max_dts code' code was restored in
9b8cc36ce0b2417469d78c68780c8796886c202e and caused the
regression when enabled by the following commit:
d119ae2fd82a494d9430ff4d4fc262961a68c598.

Also ignore streams with no data (AV_NOPTS_VALUE): when processing
files having a subtitle track but no data at all, this fixes ffmpeg
reporting N/A for both time and speed (also a regression).

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>


>From fe6d98d8d62a2d1ab50fd26f782ac8979e695c17 Mon Sep 17 00:00:00 2001
From: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Date: Mon, 16 Feb 2026 16:43:51 +0100
Subject: [PATCH] fftools/ffmpeg_sched: make trailing_dts() report max_dts
 instead of min_dts

This is to reapply 18217bb0f5fb4ad9d93ea02edab078111cd83910.
Its commit msg is still meaningful:
"Using the max instead of the min avoids the progress stopping
with gaps in sparse streams (subtitles)."

Unfortunately, the comment "compute min output value" was left
unchanged in this commit and this was pretty misleading...
So, years later, the 'max_dts code' code was restored in
9b8cc36ce0b2417469d78c68780c8796886c202e and caused the
regression when enabled by the following commit:
d119ae2fd82a494d9430ff4d4fc262961a68c598.

Also ignore streams with no data (AV_NOPTS_VALUE): when processing
files having a subtitle track but no data at all, this fixes ffmpeg
reporting N/A for both time and speed (also a regression).

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
---
 fftools/ffmpeg_sched.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c
index 517ff1ea85..12e6133667 100644
--- a/fftools/ffmpeg_sched.c
+++ b/fftools/ffmpeg_sched.c
@@ -437,7 +437,7 @@ static void task_init(Scheduler *sch, SchTask *task, enum SchedulerNodeType type
 
 static int64_t trailing_dts(const Scheduler *sch, int count_finished)
 {
-    int64_t min_dts = INT64_MAX;
+    int64_t max_dts = INT64_MIN;
 
     for (unsigned i = 0; i < sch->nb_mux; i++) {
         const SchMux *mux = &sch->mux[i];
@@ -447,14 +447,12 @@ static int64_t trailing_dts(const Scheduler *sch, int count_finished)
 
             if (ms->source_finished && !count_finished)
                 continue;
-            if (ms->last_dts == AV_NOPTS_VALUE)
-                return AV_NOPTS_VALUE;
-
-            min_dts = FFMIN(min_dts, ms->last_dts);
+            if (ms->last_dts != AV_NOPTS_VALUE)
+                max_dts = FFMAX(max_dts, ms->last_dts);
         }
     }
 
-    return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts;
+    return max_dts == INT64_MIN ? AV_NOPTS_VALUE : max_dts;
 }
 
 void sch_remove_filtergraph(Scheduler *sch, int idx)
-- 
2.52.0

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-16 17:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-16 17:10 [FFmpeg-devel] [PR] fftools/ffmpeg_sched: make trailing_dts() report max_dts instead of min_dts (PR #21770) ngaullier via ffmpeg-devel

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