diff mbox series

[FFmpeg-devel,10/12] fftools/ffmpeg_sched: move trailing_dts() higher up

Message ID 20231213193007.17471-10-anton@khirnov.net
State Accepted
Commit 98d706b8185432294617ca5b1024ea73bc248607
Headers show
Series [FFmpeg-devel,01/12] fftools/ffmpeg_filter: move FilterGraph.graph to FilterGraphThread | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Dec. 13, 2023, 7:30 p.m. UTC
Will be useful in following commit.
---
 fftools/ffmpeg_sched.c | 44 +++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c
index 69f8c0c3c0..ab14d6233e 100644
--- a/fftools/ffmpeg_sched.c
+++ b/fftools/ffmpeg_sched.c
@@ -423,6 +423,28 @@  static void task_init(Scheduler *sch, SchTask *task, enum SchedulerNodeType type
     task->func_arg  = func_arg;
 }
 
+static int64_t trailing_dts(const Scheduler *sch)
+{
+    int64_t min_dts = INT64_MAX;
+
+    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)
+                continue;
+            if (ms->last_dts == AV_NOPTS_VALUE)
+                return AV_NOPTS_VALUE;
+
+            min_dts = FFMIN(min_dts, ms->last_dts);
+        }
+    }
+
+    return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts;
+}
+
 int sch_stop(Scheduler *sch)
 {
     int ret = 0, err;
@@ -1162,28 +1184,6 @@  int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_
     return 0;
 }
 
-static int64_t trailing_dts(const Scheduler *sch)
-{
-    int64_t min_dts = INT64_MAX;
-
-    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)
-                continue;
-            if (ms->last_dts == AV_NOPTS_VALUE)
-                return AV_NOPTS_VALUE;
-
-            min_dts = FFMIN(min_dts, ms->last_dts);
-        }
-    }
-
-    return min_dts == INT64_MAX ? AV_NOPTS_VALUE : min_dts;
-}
-
 static void schedule_update_locked(Scheduler *sch)
 {
     int64_t dts;