PR #21775 opened by ngaullier URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21775 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21775.patch
Here is a straightforward mpegts sample with teletext subtitles declared in the PMT but no data (only stuffing and signaling: nothing at decoder output), so it exhibits the N/A reporting issue: https://0x0.st/PMyL.ts Simple cmdline (to be used with -re or -stats_period) ffmpeg -txt_format text -i PMyL.ts -c:s srt -f null - ---- 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)." Also on a very similar issue: currently, a single stream with no data makes ffmpeg reports N/A for both time and speed. Fix this by ignoring missing dtses. Fix regressions since d119ae2fd82a494d9430ff4d4fc262961a68c598. Signed-off-by: Nicolas Gaullier <[email protected]> >From dca5622564a147091a281b8751b7e48890d70d02 Mon Sep 17 00:00:00 2001 From: Nicolas Gaullier <[email protected]> Date: Tue, 17 Feb 2026 12:07:51 +0100 Subject: [PATCH] fftools/ffmpeg_sched: report progress using max dts instead of trailing_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)." Also on a very similar issue: currently, a single stream with no data makes ffmpeg reports N/A for both time and speed. Fix this by ignoring missing dtses. Fix regressions since d119ae2fd82a494d9430ff4d4fc262961a68c598. Signed-off-by: Nicolas Gaullier <[email protected]> --- fftools/ffmpeg_sched.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index 517ff1ea85..dc5800d094 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -435,7 +435,7 @@ static void task_init(Scheduler *sch, SchTask *task, enum SchedulerNodeType type task->func_arg = func_arg; } -static int64_t trailing_dts(const Scheduler *sch, int count_finished) +static int64_t trailing_dts(const Scheduler *sch) { int64_t min_dts = INT64_MAX; @@ -445,7 +445,7 @@ static int64_t trailing_dts(const Scheduler *sch, int count_finished) for (unsigned j = 0; j < mux->nb_streams; j++) { const SchMuxStream *ms = &mux->streams[j]; - if (ms->source_finished && !count_finished) + if (ms->source_finished) continue; if (ms->last_dts == AV_NOPTS_VALUE) return AV_NOPTS_VALUE; @@ -457,6 +457,26 @@ static int64_t trailing_dts(const Scheduler *sch, int count_finished) return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts; } +static int64_t progressing_dts(const Scheduler *sch, int count_finished) +{ + int64_t max_dts = INT64_MIN; + + for (unsigned i = 0; i < sch->nb_mux; i++) { + const SchMux *mux = &sch->mux[i]; + + for (unsigned j = 0; j < mux->nb_streams; j++) { + const SchMuxStream *ms = &mux->streams[j]; + + if (ms->source_finished && !count_finished) + continue; + if (ms->last_dts != AV_NOPTS_VALUE) + max_dts = FFMAX(max_dts, ms->last_dts); + } + } + + return max_dts == INT64_MIN ? AV_NOPTS_VALUE : max_dts; +} + void sch_remove_filtergraph(Scheduler *sch, int idx) { SchFilterGraph *fg = &sch->filters[idx]; @@ -1399,9 +1419,9 @@ static void schedule_update_locked(Scheduler *sch) if (atomic_load(&sch->terminate)) return; - dts = trailing_dts(sch, 0); + dts = trailing_dts(sch); - atomic_store(&sch->last_dts, dts); + atomic_store(&sch->last_dts, progressing_dts(sch, 0)); // initialize our internal state for (unsigned type = 0; type < 2; type++) @@ -2768,7 +2788,7 @@ int sch_stop(Scheduler *sch, int64_t *finish_ts) } if (finish_ts) - *finish_ts = trailing_dts(sch, 1); + *finish_ts = progressing_dts(sch, 1); sch->state = SCH_STATE_STOPPED; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
