From patchwork Tue Aug 25 14:09:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21915 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 59FF544B6CA for ; Tue, 25 Aug 2020 17:10:26 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 410C568AF73; Tue, 25 Aug 2020 17:10:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E1FAB68ABC3 for ; Tue, 25 Aug 2020 17:10:16 +0300 (EEST) Received: by mail-ej1-f67.google.com with SMTP id d11so16518128ejt.13 for ; Tue, 25 Aug 2020 07:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GVTIy8JdJ+5uIbmwiLo+WVtTGUga1c2pR/sSC/0OyjQ=; b=eqcEYmGBN2aPmkBwYEhGdFGcqU0FK6W3bRXgOe+D02SN68mvPZYElqfp6Xc05nj3TS PCBJcG1I1kkyfNjHsuJbtMIRE1WC7IMFu/zzmfkHqaz3wnY4F2SyfAId+3fiPMpXQbPd 6j6G0tR9FjfE0FgKeGuXSVT/W4NSqk3cRKu+63khJ4Vplp0ZAMmvRqyExTH4W6vj70Gk ra82f48Hq8Twqj0srDKZFuDF+9M9ApYSYgX4EEJai9QIBVHM5Gqt2FItuQFdj5z3wA4N Cjif6ng+NVrJhMTJbhbw9szQB665q+T2JByNT268e6Oo0n679AWGQFMIHrBpBRCvxp+h gsEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GVTIy8JdJ+5uIbmwiLo+WVtTGUga1c2pR/sSC/0OyjQ=; b=H3Zb9wdOYBLbhs71PDRbhgIGjjVSDNVN7bbg4wrx2ipcn6zNYI4OlccwTkzkVLKioZ QhI2D6otV6I/2y6KXzQwUQRp37X1a/9l+GTiqA+Yvr5HKi97T9NzJyWdCzVTcXSob70I a9G+EuS9//xw7XJRqqu092HiVbqJ9h+MBU6EPoDe/2SJDbpsrnYHzSmoejmNw9B2NlyH Oh+XrK7iCAgUVlEeU5DTd1nbfTYkAUrr4wFnzddhi2uwfvXBOYaO7tQ/6u7OHvpZ+iHY aujhP8GcXH+LbRw+vbqfHUfkYfKTAX7GCcLvvDYaYL96xUJPta9NY5o8xKpo2WeL9GWn VclA== X-Gm-Message-State: AOAM533iNjIhPZ54cLOBtqIo6h0NcW8tJLhaSFl8RCZsfVx5FCmFc3RU eUrvOSiotqQ6ngsRyM4r/aKnQAfBYig= X-Google-Smtp-Source: ABdhPJx7zbVOc7qiMfhBbJZBmeNcybX0RwPhFU1ogNq6hHpMcNuXMEP9kVmGPJvm99bt2g84l0u1nQ== X-Received: by 2002:a17:906:74cf:: with SMTP id z15mr10634916ejl.258.1598364616040; Tue, 25 Aug 2020 07:10:16 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id k25sm10169806edx.96.2020.08.25.07.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 07:10:15 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Aug 2020 16:09:18 +0200 Message-Id: <20200825140927.16433-10-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200825140927.16433-1-andreas.rheinhardt@gmail.com> References: <20200825140927.16433-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/19] avfilter/avf_aphasemeter: Don't allocate outpad names 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" These names are always the same, so not using duplicates saves allocations, checks for the allocations as well as frees. Signed-off-by: Andreas Rheinhardt --- libavfilter/avf_aphasemeter.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c index be0b2fb70f..53d1de29d3 100644 --- a/libavfilter/avf_aphasemeter.c +++ b/libavfilter/avf_aphasemeter.c @@ -227,11 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static av_cold void uninit(AVFilterContext *ctx) { AudioPhaseMeterContext *s = ctx->priv; - int i; av_frame_free(&s->out); - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); } static av_cold int init(AVFilterContext *ctx) @@ -241,30 +238,22 @@ static av_cold int init(AVFilterContext *ctx) int ret; pad = (AVFilterPad){ - .name = av_strdup("out0"), + .name = "out0", .type = AVMEDIA_TYPE_AUDIO, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, 0, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } if (s->do_video) { pad = (AVFilterPad){ - .name = av_strdup("out1"), + .name = "out1", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, 1, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } } return 0;