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 DD7BE4FA19 for ; Tue, 24 Jun 2025 19:24:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9457D68D384; Tue, 24 Jun 2025 22:23:55 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5F6F868D313 for ; Tue, 24 Jun 2025 22:23:52 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 19827E9EF1; Tue, 24 Jun 2025 21:21:05 +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 3l0H1jybUsTj; Tue, 24 Jun 2025 21:21:03 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5EBEAE9E73; Tue, 24 Jun 2025 21:21:03 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Jun 2025 21:23:06 +0200 Message-ID: <20250624192318.7430-8-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 08/12] avfilter: signal an empty buffersrc with an explicit activate error code 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: No change in functionality. Signed-off-by: Marton Balint --- libavfilter/avfiltergraph.c | 2 ++ libavfilter/buffersink.c | 5 ++++- libavfilter/buffersrc.c | 4 ++-- libavfilter/filters.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 2d6036df74..38b89db22a 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1460,6 +1460,8 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) frame_count = oldesti->l.frame_count_out; while (frame_count == oldesti->l.frame_count_out) { r = ff_filter_graph_run_once(graph); + if (r == FFERROR_BUFFERSRC_EMPTY) + r = 0; if (r == AVERROR(EAGAIN) && !oldesti->frame_wanted_out && !oldesti->frame_blocked_in && !oldesti->status_in) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 5cd47ba69f..fb33ad59c5 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -131,8 +131,11 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i return AVERROR(EAGAIN); } else if (li->frame_wanted_out) { ret = ff_filter_graph_run_once(ctx->graph); - if (ret < 0) + if (ret == FFERROR_BUFFERSRC_EMPTY) { + // Do nothing for now... + } else if (ret < 0) { return ret; + } } else { ff_inlink_request_frame(inlink); } diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index af27306b3b..7e86d6ffd3 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -195,7 +195,7 @@ static int push_frame(AVFilterGraph *graph) ret = ff_filter_graph_run_once(graph); if (ret == AVERROR(EAGAIN)) break; - if (ret < 0) + if (ret < 0 && ret != FFERROR_BUFFERSRC_EMPTY) return ret; } return 0; @@ -552,7 +552,7 @@ static int activate(AVFilterContext *ctx) return 0; } c->nb_failed_requests++; - return FFERROR_NOT_READY; + return FFERROR_BUFFERSRC_EMPTY; } static const AVFilterPad avfilter_vsrc_buffer_outputs[] = { diff --git a/libavfilter/filters.h b/libavfilter/filters.h index e3013eda65..11152cfabf 100644 --- a/libavfilter/filters.h +++ b/libavfilter/filters.h @@ -31,6 +31,7 @@ * Special return code when activate() did not do anything. */ #define FFERROR_NOT_READY FFERRTAG('N','R','D','Y') +#define FFERROR_BUFFERSRC_EMPTY FFERRTAG('M','P','T','Y') /** * A filter pad used for either input or output. -- 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".