From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 3B41D4FA27 for ; Tue, 24 Jun 2025 19:26:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id F05F068D3D2; Tue, 24 Jun 2025 22:24:08 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id DD79268D418 for ; Tue, 24 Jun 2025 22:24:06 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9704DE9F05; Tue, 24 Jun 2025 21:21:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sgnXAQLtJvZi; Tue, 24 Jun 2025 21:21:18 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 16642EA190; Tue, 24 Jun 2025 21:21:18 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Jun 2025 21:23:10 +0200 Message-ID: <20250624192318.7430-12-cus@passwd.hu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624192318.7430-1-cus@passwd.hu> References: <20250624192318.7430-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/12] avfilter/ffmpeg_filter: rate control all filter graphs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 --- 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 f6e496158c..2822335e15 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -53,8 +53,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; @@ -1112,16 +1110,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); @@ -1648,10 +1636,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, @@ -2647,7 +2633,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) { @@ -2666,7 +2651,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 */ @@ -2681,9 +2666,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)) { @@ -2700,7 +2682,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; -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".