From patchwork Thu May 23 21:37:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 13261 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0E2EB448449 for ; Fri, 24 May 2019 00:37:31 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E230E68A5FA; Fri, 24 May 2019 00:37:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 169F968A5FA for ; Fri, 24 May 2019 00:37:24 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id DF50BE1765; Thu, 23 May 2019 23:37: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 wHQgKmitzjbr; Thu, 23 May 2019 23:37:23 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id CB78EE175A; Thu, 23 May 2019 23:37:22 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 May 2019 23:37:17 +0200 Message-Id: <20190523213718.31673-1-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/f_loop: fix video loop issues with 0 size or when size is bigger than input 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes infinte loop with -vf loop=loop=1 and also fixes looping when the input is less frames than the specified loop size. Possible regressions since ef1aadffc785b48ed62c45d954289e754f43ef46. Signed-off-by: Marton Balint --- libavfilter/f_loop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavfilter/f_loop.c b/libavfilter/f_loop.c index d9d55f9837..fcbd742eb4 100644 --- a/libavfilter/f_loop.c +++ b/libavfilter/f_loop.c @@ -343,7 +343,7 @@ static int activate(AVFilterContext *ctx) FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); - if (!s->eof && (s->nb_frames < s->size || !s->loop)) { + if (!s->eof && (s->nb_frames < s->size || !s->loop || !s->size)) { ret = ff_inlink_consume_frame(inlink, &frame); if (ret < 0) return ret; @@ -352,11 +352,13 @@ static int activate(AVFilterContext *ctx) } if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) { - if (status == AVERROR_EOF) + if (status == AVERROR_EOF) { + s->size = s->nb_frames; s->eof = 1; + } } - if (s->eof && (s->loop == 0 || s->nb_frames < s->size)) { + if (s->eof && (!s->loop || !s->size)) { ff_outlink_set_status(outlink, AVERROR_EOF, s->duration); return 0; }