From patchwork Thu Jul 13 10:55:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42665 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp2825662pzb; Thu, 13 Jul 2023 04:03:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGbZh1C7mEU+8W4CIe1vfVc3lqJwNAMQ0Co5j2kIBpyI4B9iGKYSGh502p8Nb7KFM/oGKPC X-Received: by 2002:a17:906:220e:b0:974:1ef1:81ad with SMTP id s14-20020a170906220e00b009741ef181admr1143465ejs.4.1689246209757; Thu, 13 Jul 2023 04:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689246209; cv=none; d=google.com; s=arc-20160816; b=Fj96zQDnVocFVoj6IJcXFpa1fayBR9cVJwPgh8tktbWeU5vQazlefA2w9n83n2SBpD TJHA7dOInqj7oBoNnLkKjl8HlhIxHKAvJuDS4Q4xhRXBk+F+c1qpD6j6egwTmgz/bKDy WOSrI75OYGknOp+psGe6i86orMSlFNVjmkiq1u8QWeGWiZbUSQcN82vCOMx16upPt2oW HcvBNhO7nKKXs5lZvt4JXAioA/UGqEtFkOLdewVFPt02eTpuVb8BJxNE7iuZeYVQsHPA 57p94St4Swo8raRStbvjlGvmjKKFQiPS6j3GYCXDCHfm+RZ4lJlRSzvx9T38pry1i5rh +aZA== 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=qRvaH0nrwi0gL4oPhEuee1EPT070P+HtYLyfKy5rfrsmH7GukU/ZIkOo+HXSyWVwng C5aOqXiysBXj+3V2Vk7bfArXpjNd6r91dDvDISCZKKcxIZhcMFP/Ulv59utIA4GRg5eL jU5z5vidO5Z1iI5BrOuYptK3OLKY7SOsEHRbCaSeFMkZB7xG5sM9661f7FLdycr4eWlN bWMvpTvuSdzMxVDMnPmI+iVqbGG32bS6Dtg0T2KA1wlAJuAODzG0j6vjY3PYXNoiPBzV DABtMkCT1ydyq/+CIBwq7/2GsgMqLe8WXl+2b9O2NTgqQCJLrcYc0RO2oWigwAaojMaH uKiQ== 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 g10-20020a1709067c4a00b0098e07395330si6666638ejp.746.2023.07.13.04.03.29; Thu, 13 Jul 2023 04:03:29 -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 358C768C6F5; Thu, 13 Jul 2023 14:03:27 +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 5452468C6DC for ; Thu, 13 Jul 2023 14:03:20 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 1C5952404EE for ; Thu, 13 Jul 2023 13:03:20 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ejQ36R8eukfv for ; Thu, 13 Jul 2023 13:03:19 +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 4CB9E2404EC for ; Thu, 13 Jul 2023 13:03:19 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3FB273A2169 for ; Thu, 13 Jul 2023 12:57:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 13 Jul 2023 12:55:48 +0200 Message-Id: <20230713105553.21052-28-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230713105553.21052-1-anton@khirnov.net> References: <20230713105553.21052-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 28/33] 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: ilPpQduoxahG 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) {