From patchwork Thu Dec 29 14:34:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 1978 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2439998vsb; Thu, 29 Dec 2016 06:36:37 -0800 (PST) X-Received: by 10.28.225.138 with SMTP id y132mr37166087wmg.52.1483022197864; Thu, 29 Dec 2016 06:36:37 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n70si54561004wmd.139.2016.12.29.06.36.34; Thu, 29 Dec 2016 06:36:37 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BC486689D8D; Thu, 29 Dec 2016 16:34:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F3F2B689BD0 for ; Thu, 29 Dec 2016 16:34:11 +0200 (EET) Received: from phare.normalesup.org (archicubes.ens.fr [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id uBTEYFjp080463 for ; Thu, 29 Dec 2016 15:34:15 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 02682E00F9; Thu, 29 Dec 2016 15:34:14 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Dec 2016 15:34:02 +0100 Message-Id: <20161229143403.2851-16-george@nsup.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161229143403.2851-1-george@nsup.org> References: <20161229143403.2851-1-george@nsup.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Thu, 29 Dec 2016 15:34:15 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 16/17] lavfi: do not call ff_filter_frame() with activate. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" avfilter_graph_request_oldest() does work that should be done by either the filter or the application. The principle of this function, calling ff_request_frame() from outside the filter was always shaky. This version is less elegant since it requires making special cases for each filter, but it is more robust since it no longer calls ff_request_frame() directly without notifying the filter. Eventually, avfilter_graph_request_oldest() will be deprecated for a function to just run the graph. Signed-off-by: Nicolas George --- libavfilter/avfiltergraph.c | 7 +++++++ 1 file changed, 7 insertions(+) Unchanged. diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 10df84faa5..1eac29f299 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -35,6 +35,7 @@ #define FF_INTERNAL_FIELDS 1 #include "avfilter.h" #include "avfilterlink.h" +#include "buffersink.h" #include "formats.h" #include "internal.h" #include "thread.h" @@ -1388,6 +1389,11 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) while (graph->sink_links_count) { oldest = graph->sink_links[0]; + if (oldest->dst->filter->activate) { + /* For now, buffersink is the only filter implementing activate. */ + return av_buffersink_get_frame_flags(oldest->dst, NULL, + AV_BUFFERSINK_FLAG_PEEK); + } r = ff_request_frame(oldest); if (r != AVERROR_EOF) break; @@ -1402,6 +1408,7 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) } if (!graph->sink_links_count) return AVERROR_EOF; + av_assert1(!oldest->dst->filter->activate); av_assert1(oldest->age_index >= 0); frame_count = oldest->frame_count_out; while (frame_count == oldest->frame_count_out) {