From patchwork Tue Aug 25 14:09:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21912 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 4FCFF44B6CA for ; Tue, 25 Aug 2020 17:10:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 35D9468AD72; Tue, 25 Aug 2020 17:10:23 +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 AC25368AAF6 for ; Tue, 25 Aug 2020 17:10:14 +0300 (EEST) Received: by mail-ej1-f67.google.com with SMTP id o18so16727300eje.7 for ; Tue, 25 Aug 2020 07:10:14 -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=2cKapQQ03jIL5kKTy1L5KKf41JhWoPXpdPNeFN2J/3c=; b=aGh9KJ2/Utzv48wGdQ8R8o3nCRpILscQFkCZvFQqWMpSARE8SYwafDimMUk9KDspik qrR4hEG3i7H71imHW+j/EtdcpDKhummoUleFx3nUXGepDZln/I6AI8afCDZQyQicj5Vv Tdjt/Jw9mGulIZBdFrZw5LOjM3iNgaPw0YJ81/n3lJWTJHbq+VsSi51wFgK+dg75+Olu T/5okBZfjNedVpgx5moQ8zAKiGAWs+lu1PUJuIdBawMyimi4DtgZdGA0NJNju+N388Lj 38DUm4pfHbVysZAFoSsVEGVw8x6yjYDsAbWvVZVrclDyFSKeYNTyOL5IUPJbbtY9mOr/ Dxxg== 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=2cKapQQ03jIL5kKTy1L5KKf41JhWoPXpdPNeFN2J/3c=; b=GHogcNscz7sG8Jt3mQdcMHvjk/cLcSeYRto84dabQ8DUyHJUzH78FugTVbPmKRb7l2 Zd0PvYfdTbTlRd7kz8O4gsARFsjodhJivfjKZNXJlnJ3xEcoOEaa5mX9AAHMxxucgXUs gQlD5i7LzKumNVzr4EooMGg6kxjTiZtzstLqsuzGWlzfvh4crFuwKkNNOJhjjkBCdqs5 Mlycl6Qjw2QU9kLT9TkhJdG1JfC2IBtEB/0V9FK5VYnG98uION4R6HcKsbphggladf7n 8YNku6RCPQ0fkWJXXTizPHe1GEScbVuiJqiX1B8pG9wwUcp91Tw0o4zlA/K6f3RZnPg8 tDPQ== X-Gm-Message-State: AOAM530fThnczBDdQ25AX8mmHI1em/H0oG5Ci3W8M2JtUP8v1rrPKdvr KzuG3oNKINVLAlBBt11gCLW1SEivC+s= X-Google-Smtp-Source: ABdhPJxyTy/7JiVgduLTRqughHHck9z4bRfMDKvn7fsSQYo0mATUgQ4ge6cABuc5Cgl9QCSUwCUKvw== X-Received: by 2002:a17:907:35d0:: with SMTP id ap16mr11258766ejc.457.1598364613695; Tue, 25 Aug 2020 07:10:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 07:10:13 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Aug 2020 16:09:16 +0200 Message-Id: <20200825140927.16433-8-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 08/19] avfilter/f_ebur128: 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 mostly the same, so not using duplicates saves allocations, checks for the allocations as well as frees. Signed-off-by: Andreas Rheinhardt --- libavfilter/f_ebur128.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 31b75ab097..5ae3dc25b8 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -527,30 +527,22 @@ static av_cold int init(AVFilterContext *ctx) /* insert output pads */ if (ebur128->do_video) { pad = (AVFilterPad){ - .name = av_strdup("out0"), + .name = "out0", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - 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; - } } pad = (AVFilterPad){ - .name = av_asprintf("out%d", ebur128->do_video), + .name = ebur128->do_video ? "out1" : "out0", .type = AVMEDIA_TYPE_AUDIO, .config_props = config_audio_output, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, ebur128->do_video, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } /* summary */ av_log(ctx, AV_LOG_VERBOSE, "EBU +%d scale\n", ebur128->meter); @@ -990,8 +982,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&ebur128->i400.cache[i]); av_freep(&ebur128->i3000.cache[i]); } - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); av_frame_free(&ebur128->outpicref); #if CONFIG_SWRESAMPLE av_freep(&ebur128->swr_buf);