From patchwork Sat May 30 13:31:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 19982 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 5760644A49D for ; Sat, 30 May 2020 16:31:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3AE13689BB1; Sat, 30 May 2020 16:31:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A3B426802AB for ; Sat, 30 May 2020 16:31:08 +0300 (EEST) Received: by mail-pl1-f193.google.com with SMTP id i17so2359981pli.13 for ; Sat, 30 May 2020 06:31:08 -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; bh=VBhzrlJvXWewqNmcubVClzqM3JcXACQYgXNIOmQ9VXo=; b=LjUYtGt8DSY6wX1pGzh9x7ZdyqKNS+8siVGgEk1jmzxc+uA7M3qLyn1m6LSrn2qymv BwjZPONbFQSdnu78kBqn2Gax72j9z/wky7FlknJ68LFztwuLmL8Sax/A65OPY+mukVDN LO8oxP0iVh47+IgVJ5UktGFMvAHGWmWj+C053OWu03uT9kK0B4bZ9dX7O2QWTmwcag7W nms1t+10vr8VSbAh4BRkeLXzBhgmqlc4YANpG7GBdFBmG/kEuklR0lQNBjXfQIcRaXiC pzJ5we0PVMBHK5VG13oQ2TRfEuQIDCw1/I+BfbjKx69Kp8lmzQn5njfceEsTeLZKoxtB cHpQ== 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; bh=VBhzrlJvXWewqNmcubVClzqM3JcXACQYgXNIOmQ9VXo=; b=Dd4GCD2zutmUY6FfNraPDz977qJkUJWB3itOl0lJW6JvAvGDddP2Iuh3nO+JVPbEg4 KF0yWf5EkmZPOePcketyWPjtnol17GD7jrccKW+sEr8qicqHfzBEV9Pwc1Ywt6k0Hfwf jms9IynlwAPaG4BdWs4MvnDZ4R0q+LtMnEiLYvblotboPd0w3fxpl+YGruMIOIX0WQWn CGyB3I9+tjTzzvtbwJVfwstV/h8Rp/MUAcHs+48+X8nG6CyyfxvxhVNJ3q6sinGq9vDE 5PmuALx7X+wDt+bHvQE8NwRQPpQoxK1M4JZHVBYhsM/lLQky8g1wQEz29eVTjCmsb07Y Z3Kw== X-Gm-Message-State: AOAM5326szqC7E+g5aGZOHejrfhYE346zansG3xwvTmh/FV//5+3x8mu JWKSjRjBiviHE2EhivkD8o5LA9X+ X-Google-Smtp-Source: ABdhPJz1ieQueTO064KD8a9e7+a4PvbeqNn7wqHd2q2hjVnqfbEb/ZqE6b8kRJauNJ3MaSr2eieg+Q== X-Received: by 2002:a17:90a:aa8d:: with SMTP id l13mr14796436pjq.92.1590845466913; Sat, 30 May 2020 06:31:06 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id q134sm10002262pfc.143.2020.05.30.06.31.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2020 06:31:06 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 30 May 2020 21:31:00 +0800 Message-Id: <1590845462-9163-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/3] avutil/dict: av_realloc -> av_realloc_array() 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavutil/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/dict.c b/libavutil/dict.c index 0ea7138..a1107b1 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -103,8 +103,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, av_free(tag->key); *tag = m->elems[--m->count]; } else if (copy_value) { - AVDictionaryEntry *tmp = av_realloc(m->elems, - (m->count + 1) * sizeof(*m->elems)); + AVDictionaryEntry *tmp = av_realloc_array(m->elems, + m->count + 1, sizeof(*m->elems)); if (!tmp) goto err_out; m->elems = tmp; From patchwork Sat May 30 13:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 19984 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 2A96244BDA9 for ; Sat, 30 May 2020 16:37:39 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0997868A659; Sat, 30 May 2020 16:37:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A1EF680987 for ; Sat, 30 May 2020 16:37:32 +0300 (EEST) Received: by mail-pf1-f194.google.com with SMTP id 64so1216914pfg.8 for ; Sat, 30 May 2020 06:37:32 -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; bh=ke1DIXXW19960euu8ejbnDecOHLr5f6M10NCFjHxERM=; b=TZky1wpq8ljFMbTmrCj3C3yuXq54fsTNgJLray5aOjZbd06sfEvgh/5eMt9gZ1EJxb qtOpKCi3maAeokVHoK2nLhDWvvEmTdYSmykqniFvVa0Y3xnH3pk3DoN3lUuT2lFCoSd2 5nFPGDVgb9NZ16GY7preKiU/sBm1E8q8LjSqhdC1Fgnc1y7ukAnrSQWwv3XlI/sPHJxz ADb8KWqkLT6Sbx/EV4x2zWxHve4ASLP+5BIV0haaea2o/y2Uuyq6uaNT8ye9Ya92jF5u KVSoc90Kk+5JNqJK4/B8/xkXmmYS2pVY3xet7++suptsAvtayGGviHDL8g9ccfNI6Qv6 ffdQ== 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; bh=ke1DIXXW19960euu8ejbnDecOHLr5f6M10NCFjHxERM=; b=Ct1xC5DHxxE44lJcvRiig8AHnoKUEf3iQ+BqBwSo5WtULaxd15u9ZoKMVJjOVj/EYR Qzi9Ho1PyUV1ldV66k/hpCQNjZnziDZvx/x8jMYH/zeKN4SQ2VL+uVfUG0SO5o5Pb0vS gXhCbLk+TNTPBzGKM9CeqGxx/y5VqKSSvft+0LJkl6UXQpWShxUmZHlX+dCV25NCnrvB 9MKQ0PbrLvX4ciEq2lRSQlASCUg3rELJ1RaFEMgh/Kn8MMlBHz1KL0OKWx04Rr5lYJM5 L5wl5Gew0Vk2qc0/YBhU8D08T0hiX3I7ZUnGpWalbPRdNNpUWLb5rFkNnTuMVSmUlGzj zdYQ== X-Gm-Message-State: AOAM530T6VnjdZlS9XtKUzaLeE5AdEXYohAoFdE1XsBFoggcQlKPh5UW HjrsIr3KY+Bh0oJjC9GX4q65vlOb X-Google-Smtp-Source: ABdhPJw8+XuQCBIJdFmn674gBG9wknYCFa9m5dcQpOHca6Tobm4BmMshciRmUPvD7VopvjbpwfvT4A== X-Received: by 2002:a17:902:6bc1:: with SMTP id m1mr5378572plt.158.1590845468437; Sat, 30 May 2020 06:31:08 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id q134sm10002262pfc.143.2020.05.30.06.31.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2020 06:31:07 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 30 May 2020 21:31:01 +0800 Message-Id: <1590845462-9163-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590845462-9163-1-git-send-email-lance.lmwang@gmail.com> References: <1590845462-9163-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/alac: Add FF_CODEC_CAP_INIT_CLEANUP 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/alac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 82689da..3b41373 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -511,7 +511,6 @@ static int allocate_buffers(ALACContext *alac) } return 0; buf_alloc_fail: - alac_decode_close(alac->avctx); return AVERROR(ENOMEM); } @@ -625,5 +624,6 @@ AVCodec ff_alac_decoder = { .close = alac_decode_close, .decode = alac_decode_frame, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .priv_class = &alac_class }; From patchwork Sat May 30 13:31:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 19983 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 62AAD44A49D for ; Sat, 30 May 2020 16:31:19 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4CD4A68A454; Sat, 30 May 2020 16:31:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E92516898AE for ; Sat, 30 May 2020 16:31:11 +0300 (EEST) Received: by mail-pf1-f194.google.com with SMTP id n15so1233880pfd.0 for ; Sat, 30 May 2020 06:31:11 -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; bh=1pG2D+PCD3AtixNJYXQ7HuLt5rtuax01qh1wrt4jmto=; b=dGDEpN+/DuLdtrrtmhrfUhuhuDXPYR2ENCcfaD/ch29jhBpHMPsSVZxXFAGQWsTN2C HhGalbvEEvCWLypneeknQejEghkmEgrfqWQWWC+fvRMkhUd6JRqeFMpER6bfQ1YGjYf7 YuwkJCengbo60BQzn9mnlZc7kbWoThbNyn8Qp8/VQ1ukB/6omGMA3iXrAWOBqtf9V5Dz nxshp/qyfptUL2479ENuvnCMhXlt8BqAfmDwvu92fuyUifdIyK+z76DuwIXgBSa14b/S zoW5G32KXgJcjdBiIKkxA6vOJ6KIp8G+jUUeXac0eZXGDO+OwTe0UNR/uY2Ux5f0pior TdDA== 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; bh=1pG2D+PCD3AtixNJYXQ7HuLt5rtuax01qh1wrt4jmto=; b=oxEOtT0CfdLJ2HhJyHQ/HwJWgiW+jAE2FlQ7oi67GJ3rt/Mm0AMy311FeNUHYTuoLj GjHg0w3wTxLwS5jLFxC9vpjTdjDYDnTlQPXFTarH7yMoDekXfUlLszkX+Iy4EeXKZb43 EC2dMkFzQ4Y7jA2y8JuNW7AOg5tRgKyTVM0dmk93x3PduTNzAWB3z99X9R6/mMZ5IUf2 rNW+D17x7HeJl/YIaU+2+yx5Ks1g2eAEZJKMKHYq7BbUvVxQ8F0SXe3pIJF/+E+yRvmo zQL17x1WfHuBaiEZzguGHCQTISc/a4xv7msSk95qBQPgSWfSG0gIHXGpoYR3G+sQPcqB TDrg== X-Gm-Message-State: AOAM532+x6cfhJaA062bg/SA0RGf3QAEiCk2s+REutByUzjSeIhQrn0/ DiZE+UV9Co2yeci390KvCfD8AI1c X-Google-Smtp-Source: ABdhPJypQw2hxWSWJb0OOvHijDBzcqi9clq+T9AvvzP6wq143e6cJAYOD+RNnDmIthhSTJTeoCegGg== X-Received: by 2002:a63:c948:: with SMTP id y8mr12362206pgg.118.1590845470047; Sat, 30 May 2020 06:31:10 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id q134sm10002262pfc.143.2020.05.30.06.31.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2020 06:31:09 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 30 May 2020 21:31:02 +0800 Message-Id: <1590845462-9163-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590845462-9163-1-git-send-email-lance.lmwang@gmail.com> References: <1590845462-9163-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/alac: remove FF_ALLOC_OR_GOTO and gotos label 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/alac.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 3b41373..bf05406 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -489,6 +489,7 @@ static int allocate_buffers(ALACContext *alac) { int ch; unsigned buf_size = alac->max_samples_per_frame * sizeof(int32_t); + unsigned extra_buf_size = buf_size + AV_INPUT_BUFFER_PADDING_SIZE; for (ch = 0; ch < 2; ch++) { alac->predict_error_buffer[ch] = NULL; @@ -497,21 +498,19 @@ static int allocate_buffers(ALACContext *alac) } for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) { - FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch], - buf_size, buf_alloc_fail); + if (!(alac->predict_error_buffer[ch] = av_malloc(buf_size))) + return AVERROR(ENOMEM); alac->direct_output = alac->sample_size > 16; if (!alac->direct_output) { - FF_ALLOC_OR_GOTO(alac->avctx, alac->output_samples_buffer[ch], - buf_size + AV_INPUT_BUFFER_PADDING_SIZE, buf_alloc_fail); + if (!(alac->output_samples_buffer[ch] = av_malloc(extra_buf_size))) + return AVERROR(ENOMEM); } - FF_ALLOC_OR_GOTO(alac->avctx, alac->extra_bits_buffer[ch], - buf_size + AV_INPUT_BUFFER_PADDING_SIZE, buf_alloc_fail); + if (!(alac->extra_bits_buffer[ch] = av_malloc(extra_buf_size))) + return AVERROR(ENOMEM); } return 0; -buf_alloc_fail: - return AVERROR(ENOMEM); } static int alac_set_info(ALACContext *alac)