From patchwork Tue Oct 3 15:35:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 44126 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1204:b0:15d:8365:d4b8 with SMTP id v4csp2141202pzf; Tue, 3 Oct 2023 08:37:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8pnQfDHQTNSOInCELRvdH116XNEZ51xkuBVf5Uzmg/GkANt9apdAM8D2nJwByp8/v2F7G X-Received: by 2002:a05:6402:884:b0:523:b1b0:f69f with SMTP id e4-20020a056402088400b00523b1b0f69fmr12979779edy.32.1696347448348; Tue, 03 Oct 2023 08:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696347448; cv=none; d=google.com; s=arc-20160816; b=uq+o2AWfcUhMauEY89ul9tFDAe3Kd9ItT32c9EKctCbrfdcLmkU+QoyDpGJ+EaMO8U V1ppUqROnR0AEB9yxhFjxeGnBZBJF6k0qtcEfwodo8XjW7Nj6P1cz3iYyK6wyGnDCQ44 zgcMv5exCpZaP2b4c3kYR+iFvKbDvnAMPrfGH8uVnhSAAp7RUwGrZ3Omouo/Y/61b7EJ bVqvbZskHW6ZFdkKB1/ySkfmuQagXTw7rcMtp1vkvGaw7MNuf3gzE08P/H2lsnFhaOcB 4n5pIRb44GRUqGxZ+x4fB7lQ2g95LL2pBf4luARjiSmAANbQo0gcz78FgeeLYY7d5aPl iWqA== 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=SLfIYzoKX56hy7I77C6Km6NKlPtndBfx5WtaxwqF5Tg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=p/mBKYTTDt0iv+VN7CaahS0/9quiM/lVnX/Tgm87234HxZCoGsNgjdMh4jzO/T7Bk6 6lhkFsRzSXNzxJ97BDXK9GEtsuWS9PCX73g7RBPBkFuSH8UG8X0p1/zHJOI1E/4IwZhw ejcWz26kX1i8Cs0jkgaZWbwhzFwoZrD1QFtQ4FxmczrvYQ4O1mArXo3tqbqDgZ8Stwdi u1XJ7C2WxO3OFZ4xY6ekwg16n/AVyhzC2fBQH4YcB/bszNS6SJCNl3hqV2GM19OXYDKN znrUGFDtk4un3x6jHD+uJ8/fQWh0VgsVdVl81ucdaUtUItJ6JTE0Q/3m2urxLX9bU9iD IRRQ== 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 w19-20020a056402071300b005360d6be006si728904edx.199.2023.10.03.08.37.27; Tue, 03 Oct 2023 08:37: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 8959E68CD6B; Tue, 3 Oct 2023 18:35:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E777F68CCFB for ; Tue, 3 Oct 2023 18:35:46 +0300 (EEST) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id B09DA527E for ; Tue, 3 Oct 2023 17:35:42 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id Szcw3YAIG0u6 for ; Tue, 3 Oct 2023 17:35:42 +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 mail1.khirnov.net (Postfix) with ESMTPS id 4329A5296 for ; Tue, 3 Oct 2023 17:35:40 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 6DD863A080A for ; Tue, 3 Oct 2023 17:35:33 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 3 Oct 2023 17:35:25 +0200 Message-Id: <20231003153526.19228-11-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003153526.19228-1-anton@khirnov.net> References: <20231003153526.19228-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/12] fftools/ffmpeg_filter: fail on filtering errors 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: uBI0HQUENegX These should be considered serious errors - don't just print a log message and continue as if nothing happened. --- fftools/ffmpeg_filter.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 0df284c334..129487cf88 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -2152,17 +2152,17 @@ static int fg_output_step(OutputFilterPriv *ofp, int flush) ret = av_buffersink_get_frame_flags(filter, frame, AV_BUFFERSINK_FLAG_NO_REQUEST); - if (ret < 0) { - 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 && ofp->got_frame && - av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO) { - ret = fg_output_frame(ofp, NULL); - return (ret < 0) ? ret : 1; - } - + if (flush && ret == AVERROR_EOF && ofp->got_frame && + ost->type == AVMEDIA_TYPE_VIDEO) { + ret = fg_output_frame(ofp, NULL); + return (ret < 0) ? ret : 1; + } else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { return 1; + } else if (ret < 0) { + av_log(fgp, AV_LOG_WARNING, + "Error in retrieving a frame from the filtergraph: %s\n", + av_err2str(ret)); + return ret; } if (ost->finished) { av_frame_unref(frame);