This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit f48e5d4db451cc5174a6c67979c2d39cc0b42a52
Author:     Marton Balint <[email protected]>
AuthorDate: Tue Jun 24 21:23:10 2025 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat May 23 08:41:12 2026 +0000

    fftools/ffmpeg_filter: rate control all filter graphs
    
    It was never reliable to detect if a filtergraph have sources, because a 
filter
    can act as a source only after some time, for example the loop filter.
    
    So it is better to remove the source detection entirely and always give the
    scheduler an oppurtunity to stop processing.
    
    Fixes ticket #11604.
    
    Signed-off-by: Marton Balint <[email protected]>
    Signed-off-by: Niklas Haas <[email protected]>
---
 fftools/ffmpeg_filter.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 38e39d68af..2a8de34d29 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -51,8 +51,6 @@ typedef struct FilterGraphPriv {
     // true when the filtergraph contains only meta filters
     // that do not modify the frame data
     int              is_meta;
-    // source filters are present in the graph
-    int              have_sources;
     int              disable_conversions;
 
     unsigned         nb_outputs_done;
@@ -1144,16 +1142,6 @@ int fg_create(FilterGraph **pfg, char **graph_desc, 
Scheduler *sch,
     if (ret < 0)
         goto fail;
 
-    for (unsigned i = 0; i < graph->nb_filters; i++) {
-        const AVFilter *f = graph->filters[i]->filter;
-        if ((!avfilter_filter_pad_count(f, 0) &&
-             !(f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)) ||
-            !strcmp(f->name, "apad")) {
-            fgp->have_sources = 1;
-            break;
-        }
-    }
-
     for (AVFilterInOut *cur = inputs; cur; cur = cur->next) {
         InputFilter *const ifilter = ifilter_alloc(fg);
 
@@ -1810,10 +1798,8 @@ static int configure_output_audio_filter(FilterGraphPriv 
*fgp, AVFilterGraph *gr
         pad_idx = 0;
     }
 
-    if (ofilter->apad) {
+    if (ofilter->apad)
         AUTO_INSERT_FILTER("-apad", "apad", ofilter->apad);
-        fgp->have_sources = 1;
-    }
 
     snprintf(name, sizeof(name), "trim for output %s", ofilter->output_name);
     ret = insert_trim(fgp, ofp->trim_start_us, ofp->trim_duration_us,
@@ -2878,7 +2864,6 @@ static int read_frames(FilterGraph *fg, FilterGraphThread 
*fgt,
                        AVFrame *frame)
 {
     FilterGraphPriv *fgp = fgp_from_fg(fg);
-    int did_step = 0;
 
     // graph not configured, just select the input to request
     if (!fgt->graph) {
@@ -2897,7 +2882,7 @@ static int read_frames(FilterGraph *fg, FilterGraphThread 
*fgt,
         return AVERROR_BUG;
     }
 
-    while (fgp->nb_outputs_done < fg->nb_outputs) {
+    if (fgp->nb_outputs_done < fg->nb_outputs) {
         int ret;
 
         /* Reap all buffers present in the buffer sinks */
@@ -2912,9 +2897,6 @@ static int read_frames(FilterGraph *fg, FilterGraphThread 
*fgt,
             }
         }
 
-        // return after one iteration, so that scheduler can rate-control us
-        if (did_step && fgp->have_sources)
-            return 0;
 
         ret = avfilter_graph_request_oldest(fgt->graph);
         if (ret == AVERROR(EAGAIN)) {
@@ -2931,7 +2913,8 @@ static int read_frames(FilterGraph *fg, FilterGraphThread 
*fgt,
         }
         fgt->next_in = fg->nb_inputs;
 
-        did_step = 1;
+        // return so that scheduler can rate-control us
+        return 0;
     }
 
     return AVERROR_EOF;

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

Reply via email to