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 935DE4F236 for ; Mon, 16 Jun 2025 22:44:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 79C3568CDE2; Tue, 17 Jun 2025 01:44:21 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id A985268C846 for ; Tue, 17 Jun 2025 01:44:17 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id D2ED8ED97A; Tue, 17 Jun 2025 00:41:23 +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 k-Zjs2U8jNXQ; Tue, 17 Jun 2025 00:41:21 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 49AC3ED969; Tue, 17 Jun 2025 00:41:21 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Jun 2025 00:43:54 +0200 Message-ID: <20250616224404.16142-4-cus@passwd.hu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250616224404.16142-1-cus@passwd.hu> References: <20250616224404.16142-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/7] avfilter/avfilter: simplify processing sinks without activate callback 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: Sinks without an activate callback (nullsink, anullsink) could cause AVERROR(EAGAIN)-s in avfilter_graph_request_oldest() even when all the filter graphs inputs were in EOF state. Fixes ticket #11624. Fixes ticket #10988. Fixes ticket #10990. Signed-off-by: Marton Balint --- libavfilter/avfiltergraph.c | 38 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 2d6036df74..6f9f46f1ea 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1423,12 +1423,26 @@ void ff_avfilter_graph_update_heap(AVFilterGraph *graph, FilterLinkInternal *li) heap_bubble_down(graphi, li, li->age_index); } +static int process_legacy_sink_output(FilterLinkInternal *oldesti) +{ + AVFilterLink *oldest = &oldesti->l.pub; + int ret; + + do { + if (oldesti->frame_wanted_out) + ret = ff_filter_graph_run_once(oldest->dst->graph); + else + ret = ff_request_frame(oldest); + } while (ret >= 0); + + return ret; +} + int avfilter_graph_request_oldest(AVFilterGraph *graph) { FFFilterGraph *graphi = fffiltergraph(graph); FilterLinkInternal *oldesti = graphi->sink_links[0]; AVFilterLink *oldest = &oldesti->l.pub; - int64_t frame_count; int r; while (graphi->sink_links_count) { @@ -1437,13 +1451,11 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) if (fffilter(oldest->dst->filter)->activate) { r = av_buffersink_get_frame_flags(oldest->dst, NULL, AV_BUFFERSINK_FLAG_PEEK); - if (r != AVERROR_EOF) - return r; } else { - r = ff_request_frame(oldest); + r = process_legacy_sink_output(oldesti); } if (r != AVERROR_EOF) - break; + return r; av_log(oldest->dst, AV_LOG_DEBUG, "EOF on sink link %s:%s.\n", oldest->dst->name, oldest->dstpad->name); @@ -1453,21 +1465,7 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) oldesti->age_index); oldesti->age_index = -1; } - if (!graphi->sink_links_count) - return AVERROR_EOF; - av_assert1(!fffilter(oldest->dst->filter)->activate); - av_assert1(oldesti->age_index >= 0); - frame_count = oldesti->l.frame_count_out; - while (frame_count == oldesti->l.frame_count_out) { - r = ff_filter_graph_run_once(graph); - if (r == AVERROR(EAGAIN) && - !oldesti->frame_wanted_out && !oldesti->frame_blocked_in && - !oldesti->status_in) - (void)ff_request_frame(oldest); - else if (r < 0) - return r; - } - return 0; + return AVERROR_EOF; } int ff_filter_graph_run_once(AVFilterGraph *graph) -- 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".