From patchwork Fri Jul 7 09:48:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42496 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1e:b0:12b:9ae3:586d with SMTP id c30csp7163129pzh; Fri, 7 Jul 2023 02:52:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGlw7d8M0jlJgrJNIH6scro8PTiThgTJZOl8OfHPU6x7vdiAWuloo8m0axi/+vFVNLOG+0N X-Received: by 2002:a17:906:7385:b0:991:b292:699 with SMTP id f5-20020a170906738500b00991b2920699mr3318332ejl.5.1688723548757; Fri, 07 Jul 2023 02:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688723548; cv=none; d=google.com; s=arc-20160816; b=nvBOIPXleuHSaOEp+gYwcOpdRd8Z5A80ODlfNAEQiVr8xRiC57xZipusJwqpkuJ4qy GBbcdr8W520aeotQqHQOAeYdA3Qa60Z9pPc7/DFg9lTeF3vR9TNQn1Hd+Yb7NEUV2N0N ssMyckNhYpjWNmLdxC07wf7ORXQNfCuRlfmZVeR2oF8iYTdbigenWOG5sj7y8zSwMgib 72WbhsdJcehpdz8Q9JoIqILTvThhkI1EexqY5+FOPguOCLqtNiQ4SZra1ybjwTq7qdII 4gfAz6DWgOWAaPWGyn1BWmJXrId+uIFgVUXQOC3hybRZcsGvpt4GNY43eSIUgPrVn4NM Mfbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=34eilPtpfhoAhWoo3Wc4lWqcUvYbpb/Kw3GVlAY//EM=; fh=8ZF2QtiKOjBtyn9wuO2cMeZaLsE4aq02Bq77gGK61E8=; b=RXYYuaxLneFq1v2jd1WYgavmrfnpcxmM6f+MVAz0mV01CCEuxuQNgVV68oww7Ff7rP dVg99cS0T3tuhdYB3UUf4YmF1g2TwIntMAapLA0EOMdYIb0WXj2vssPGiJK65yzn2vJj 9cQTLRC12iU1Q/ksjlxEp2e4n5paJgUKWp8s69nawSdQ6ad85+MAiueMmY9EybiPF/kL C1yHzKTfF2OHV7+HXExc9NnQbUTa1D7I5K4mmqvGN1OnMBgdSVhwd8o3ZsqjylZFv/G3 Q69J7trP9kOCaBpxiDTecpZYMrmXJn7fpKObjkjNW3kDwasLR755IDwGPtQB+L1dgwP7 vcwg== 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 lt27-20020a170906fa9b00b0098e2a30ec3asi1762985ejb.385.2023.07.07.02.52.28; Fri, 07 Jul 2023 02:52:28 -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 D8B4168C85B; Fri, 7 Jul 2023 12:49:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F84068C7E0 for ; Fri, 7 Jul 2023 12:49:08 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 84C072406CA for ; Fri, 7 Jul 2023 11:49:05 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id RTdZ7Qw6xNOX for ; Fri, 7 Jul 2023 11:49:05 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id F3E582406CD for ; Fri, 7 Jul 2023 11:49:00 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 012003A1889 for ; Fri, 7 Jul 2023 11:48:55 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jul 2023 11:48:42 +0200 Message-Id: <20230707094847.25324-17-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230707094847.25324-1-anton@khirnov.net> References: <20230707094847.25324-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 17/22] fftools/ffmpeg_filter: only flush vsync code if encoding actually started 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cP3vegtT+PQb Otherwise this has no effect. Will be useful in following commits. --- fftools/ffmpeg_filter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index f8e64ce6cc..4955fe38dd 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1720,10 +1720,10 @@ int reap_filters(int flush) if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) { av_log(fgp, AV_LOG_WARNING, "Error in av_buffersink_get_frame_flags(): %s\n", av_err2str(ret)); - } else if (flush && ret == AVERROR_EOF) { - if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO) - enc_frame(ost, NULL); - } + } else if (flush && ret == AVERROR_EOF && ofp->got_frame && + av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO) + enc_frame(ost, NULL); + break; } if (ost->finished) {