From patchwork Sat Jun 16 12:39:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 9422 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp1861618jad; Sat, 16 Jun 2018 05:40:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLwJHKyfZWfz3aeo8sJItQlFZoBzmpfSc0mjz8uVghfpVTLTkMqnczpZ8tqFozdZ/SzPnlz X-Received: by 2002:a1c:5585:: with SMTP id j127-v6mr3771633wmb.102.1529152801672; Sat, 16 Jun 2018 05:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529152801; cv=none; d=google.com; s=arc-20160816; b=fulyJNhH5WurK5CIlMxnXzhXvynQlhCpp7M+WcysxdPq85zJY4AyaIvq2piJ0rz05v xJrp4OHWhLpsx3UhWV9fEoNMhaQgYEdCUwrwLKL/WEtZSPbIE2eBKN80aVosgJDRr93z ZZydsrQAiDVSR2eYLNxOkgQR3jsCRuf04/zt87sOm14KxVO/32uOQk9X9f7Wgil5Gho2 HuWDrYg6jnkpLpr8FzNeTcvADL3VmcAlIdmtFhLjcMFoxQdu6ubqZUNxOlkd6SnfP4eA nfbdEcKksbOWvGHi7AUOdYNajvWNgZZhfcmDYH8T6V2vm8Yn5LBHJkwGISnWErXh2pVX BONQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=MuzBmC32Nb7H5vIe5cR4aP9voVI3ZcTlCGzOV9QepHU=; b=mWw2SxKeSSWZy6D/cAM2Ksa4OloQhRshOpk9bySNHhRlk65L7COSvUngUPxV0PWuwF nBK4e3k/m/MjeiGu7gggVo9Kw0gtbCdh1AgioQiH9XKL9X1tx+VA/89btkFZNTCMbBW6 nt0YkAtj/7sc4N3Y9vIUCIQEYFpLV7AIGRCla0H0+En9PSiKExLqOUwx+hecw9IfDWu4 1VU1Qp7y9FrjdQGFV4e6acxKNng8zhLzKiqkHI9+U7eJJR8QMVlbw/LLML07ZQhYHJty 0zv7MjExy4BpsUbHu4m3Rqh/znEdqkKSEPnYviO9trHqJ23mIfv5RdKmTcWQIrcUq8Qg hKig== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=QA5aBWQ2; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k8-v6si4693960wrk.440.2018.06.16.05.40.01; Sat, 16 Jun 2018 05:40:01 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=QA5aBWQ2; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 48D2868A3B6; Sat, 16 Jun 2018 15:39:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2699668A180 for ; Sat, 16 Jun 2018 15:39:02 +0300 (EEST) Received: by mail-io0-f193.google.com with SMTP id r24-v6so13030901ioh.9 for ; Sat, 16 Jun 2018 05:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=cZDg+RFVQwGx8Y8EquYrXCKk9iWncDlriiPwYDtD1s0=; b=QA5aBWQ2dbsuv7VWkoiX82KOEDAddQ5WAAstW174at4HkMna0Tn4Gj0MYb+I5cip0a WHGR6cxAfBzv/nDMVL71TUS33m8hvL0ljEWiCAaIGdhn330aUH1p7Mz9UKui8wOXEtHe ao+9FHuX2e9y/Rhd8soxZpRneqdNYhaS8YdT0J0MJg86+X3/8NTvnMOKE3v7AB3+rPF1 pYNuszy0Z1D6T7C4WLERUmvO0ij7mqn2xjwhKXkztxIhi4IyvBIaAJXy8r2Vgvlkkjm/ G2iTvPyUBr54gj0sruiek/kFGUuKS51U2ghrY5o0kMBKQ5C08r63htXFE6Rg+rpk+NDc wRHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=cZDg+RFVQwGx8Y8EquYrXCKk9iWncDlriiPwYDtD1s0=; b=pNMP8jNN6szRuUSzPUWwxAKmYjlipEdPqD5d0Z+LSDJ2VaEd3N3cBJW1nbQzopRD9X NzCCC8kX6XzqJW47xaKEJwSevob4wde3nBefe7Bee1fcp83H/FzS7oNA7/6oB7BFNB9b R7LPn9+QbTW8yXwuATRueiKsdf04J676+Otw0dU+Dme1GyoIdACauc9JrGTLGuFL9O/G PH9furCvrpBeKW++sJYUbBVf8fPue7kf4ZqvHHedrZCuWRtnZvJHYZRnKSnBbZ885P2I NcWtAmVSX+GI0/BLRIXetXHr6rkuJQ8gpXZzfD6zglEp8rMXsEvv3Pi1PwDVimP1IWFa xbOA== X-Gm-Message-State: APt69E1EffJ9PY20oKV+IjAr8mkRSN8R+LcLeNAjQfd4lxoQY4z7SUC8 jlYJUTvHhadgszmP/OvH0g4ZzysJVhkugDUtJ2I= X-Received: by 2002:a6b:9f86:: with SMTP id i128-v6mr4604111ioe.286.1529152792334; Sat, 16 Jun 2018 05:39:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:b09b:0:0:0:0:0 with HTTP; Sat, 16 Jun 2018 05:39:51 -0700 (PDT) In-Reply-To: <92e57c52-c849-3a03-06b7-01966fd53f9a@gmail.com> References: <92e57c52-c849-3a03-06b7-01966fd53f9a@gmail.com> From: Carl Eugen Hoyos Date: Sat, 16 Jun 2018 14:39:51 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH]lavfi/avfiltergraph: Do not return ENOMEM if filter is missing 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 2018-02-05 3:05 GMT+01:00, James Almer : > On 2/4/2018 10:33 PM, Carl Eugen Hoyos wrote: >> Hi! >> >> OOM is unlikely as a failure for avfilter_graph_alloc_filter(), the >> patch avoids a surprising error if a filter was not found. >> >> Please comment, Carl Eugen >> >> >> 0001-lavfi-avfiltergraph-Do-not-return-ENOMEM-if-filterch.patch >> >> >> From 6587726a5e96570bb54e49ccf0b7fd6d94b929c8 Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Mon, 5 Feb 2018 01:43:08 +0100 >> Subject: [PATCH] lavfi/avfiltergraph: Do not return ENOMEM if filterchain >> init failed. >> >> A more likely reason is that the filter was not found. >> --- >> libavfilter/avfiltergraph.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c >> index 4cc6892..7ccd895 100644 >> --- a/libavfilter/avfiltergraph.c >> +++ b/libavfilter/avfiltergraph.c >> @@ -147,7 +147,7 @@ int avfilter_graph_create_filter(AVFilterContext >> **filt_ctx, const AVFilter *fil >> >> *filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name); >> if (!*filt_ctx) >> - return AVERROR(ENOMEM); >> + return -1; > > -1 is not acceptable for a public function that states it returns an > AVERROR value on failure. > If the issue is that avfilter_graph_alloc_filter() may fail because of > both OOM and an invalid value for filter, then I'm more inclined to use > AVERROR_UNKNOWN here instead. New patch attached. Please comment, Carl Eugen From 491b6f071865f4639fbf2530cd6d1a2c9aa87cda Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 16 Jun 2018 14:37:55 +0200 Subject: [PATCH] lavfi/avfiltergraph: Do not return ENOMEM if filterchain init failed. A more likely reason is that the filter was not found. Improves ticket #7001. --- libavfilter/avfiltergraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index a149f8f..b1c88e7 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -147,7 +147,7 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *fil *filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name); if (!*filt_ctx) - return AVERROR(ENOMEM); + return AVERROR_UNKNOWN; ret = avfilter_init_str(*filt_ctx, args); if (ret < 0) -- 1.7.10.4