From patchwork Thu Sep 7 08:59:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 5024 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.15.201 with SMTP id 70csp1672763jao; Thu, 7 Sep 2017 01:59:49 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5nvQYbhS0x8evnouIu/vMBTNVFU8HDULDbIwOtoI/wNNFL+bH98QtEcrTo+AnHUkVUhYK9 X-Received: by 10.223.199.67 with SMTP id b3mr1358936wrh.274.1504774789774; Thu, 07 Sep 2017 01:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504774789; cv=none; d=google.com; s=arc-20160816; b=bAArlavqoAuTPbqLzgXNXUU2WBUMCAYAXuXdNEOWssibHV1SQ7ldrwk9t4ZEH2xj9o WmmdvZ3jfj4EZKh9tW6tTeHK70h4JFjXuaXG4xliidq3eW/kkJ9jy0kwJM9qeqJuH/xQ 8+5fUlRjwUPq5KpFBjTLZwv2Mp/4a06sfVkX8Rd76gEjv/PY86lPoO4RaVnWpt+SUJb3 jtzh+Mw5hUHJKMcVW6PvtXohDbNNf3uy3KgOfgP3KlUzXibRWgjLgb/shXfhRPA1vvgc K9ZpNtUGJ9amUsELad62hqh9drbPme5hiCxqDtHv7E1QygIgC8oCJ3h3nrCStcmCLBi2 EbxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=rVf/7AGAjxywmmTtV7MINpeBoV62rcnDbhUqC/cqhTM=; b=xcem0ma459iujDFfcvh6stAXQqmXLCXFewlWccJKQ6E8voGG3V1X00VuH+ERmFOt/Q BbZ+LKYXKb14rZ8KQ/K6VUsul7E8Mm4awP7Fa8MB5DAW0DHsgbpUijW3Q1H3BvI7+mBh 0tl3+xclHCUp7lxLd0Hbu/JK/MRvVQVNqnC9LTkSJ5kvf7V6dzQTi0ek28HH+n7a1XtK HOOEOEnIQKCE9H5zIcGZ1IrxpTMvirx7t9oGuo6kAEHd6U/tizoPVmWOS5ZR84YDKbpY LZoBRfBSrNXeRscOOCy5u09oue0ysJv/ypwsFBKE6M65SiY5tUOjEw2V9SQYfCFFC+W7 cYdg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i132si41173wmf.259.2017.09.07.01.59.48; Thu, 07 Sep 2017 01:59:49 -0700 (PDT) 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 25F20689E0F; Thu, 7 Sep 2017 11:59:44 +0300 (EEST) 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 F03FC68043D for ; Thu, 7 Sep 2017 11:59:37 +0300 (EEST) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v878xfJi089832 for ; Thu, 7 Sep 2017 10:59:41 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 28E75E00AB; Thu, 7 Sep 2017 10:59:41 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Thu, 7 Sep 2017 10:59:35 +0200 Message-Id: <20170907085939.21770-1-george@nsup.org> X-Mailer: git-send-email 2.14.1 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Thu, 07 Sep 2017 10:59:41 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/5] lavfi: guess a timestamp for compat status change. 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" Use the earliest input with the same status. If that fails, print a warning and use the earliest source. With this change, simple filter forward correctly the timestamp of EOF. Filters that are supposed to change it should be updated to actually forward it. Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 6a97456054..e5c1238182 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -427,6 +427,24 @@ int ff_request_frame(AVFilterLink *link) return 0; } +static int64_t guess_status_pts(AVFilterContext *ctx, int status) +{ + unsigned i; + int64_t r = INT64_MAX; + + for (i = 0; i < ctx->nb_inputs; i++) + if (ctx->inputs[i]->status_out == status) + r = FFMIN(r, ctx->inputs[i]->current_pts); + if (r < INT64_MAX) + return r; + av_log(ctx, AV_LOG_WARNING, "EOF timestamp not reliable\n"); + for (i = 0; i < ctx->nb_inputs; i++) + r = FFMIN(r, ctx->inputs[i]->status_in_pts); + if (r < INT64_MAX) + return r; + return AV_NOPTS_VALUE; +} + static int ff_request_frame_to_filter(AVFilterLink *link) { int ret = -1; @@ -440,7 +458,7 @@ static int ff_request_frame_to_filter(AVFilterLink *link) ret = ff_request_frame(link->src->inputs[0]); if (ret < 0) { if (ret != AVERROR(EAGAIN) && ret != link->status_in) - ff_avfilter_link_set_in_status(link, ret, AV_NOPTS_VALUE); + ff_avfilter_link_set_in_status(link, ret, guess_status_pts(link->src, ret)); if (ret == AVERROR_EOF) ret = 0; }