From patchwork Thu Dec 29 14:33:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 1974 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2439720vsb; Thu, 29 Dec 2016 06:35:53 -0800 (PST) X-Received: by 10.28.20.139 with SMTP id 133mr38478752wmu.9.1483022153483; Thu, 29 Dec 2016 06:35:53 -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 hi2si58325957wjc.63.2016.12.29.06.35.53; Thu, 29 Dec 2016 06:35:53 -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 889EA689CFD; Thu, 29 Dec 2016 16:34:14 +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 41409689A7A for ; Thu, 29 Dec 2016 16:34:06 +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 uBTEY9UV080425 for ; Thu, 29 Dec 2016 15:34:09 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 44BA1E00F9; Thu, 29 Dec 2016 15:34:09 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Dec 2016 15:33:53 +0100 Message-Id: <20161229143403.2851-7-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:09 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 07/17] lavfi: pass min explicitly to samples_ready(). 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" Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Unchanged. diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d1ba7d9bad..d31c9f738b 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1177,10 +1177,10 @@ error: return AVERROR_PATCHWELCOME; } -static int samples_ready(AVFilterLink *link) +static int samples_ready(AVFilterLink *link, unsigned min) { return ff_framequeue_queued_frames(&link->fifo) && - (ff_framequeue_queued_samples(&link->fifo) >= link->min_samples || + (ff_framequeue_queued_samples(&link->fifo) >= min || link->status_in); } @@ -1193,7 +1193,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max, /* Note: this function relies on no format changes and must only be called with enough samples. */ - av_assert1(samples_ready(link)); + av_assert1(samples_ready(link, link->min_samples)); frame0 = frame = ff_framequeue_peek(&link->fifo, 0); if (frame->nb_samples >= min && frame->nb_samples < max) { *rframe = ff_framequeue_take(&link->fifo); @@ -1320,7 +1320,7 @@ static int ff_filter_activate_default(AVFilterContext *filter) unsigned i; for (i = 0; i < filter->nb_inputs; i++) { - if (samples_ready(filter->inputs[i])) { + if (samples_ready(filter->inputs[i], filter->inputs[i]->min_samples)) { return ff_filter_frame_to_filter(filter->inputs[i]); } }