From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTP id 853854643D
	for <ffmpegdev@gitmailbox.com>; Sat, 17 Jun 2023 15:19:19 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43A8468C3AA;
	Sat, 17 Jun 2023 18:19:08 +0300 (EEST)
Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com
 [209.85.161.50])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D26C768C09C
 for <ffmpeg-devel@ffmpeg.org>; Sat, 17 Jun 2023 18:19:00 +0300 (EEST)
Received: by mail-oo1-f50.google.com with SMTP id
 006d021491bc7-55af44f442dso1299082eaf.1
 for <ffmpeg-devel@ffmpeg.org>; Sat, 17 Jun 2023 08:19:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1687015139; x=1689607139;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=jvksy0Zs8edtbUaRjOtRIECsmgBu9zcu77ROzm+r5ss=;
 b=BTJh3OfJ776WgF+h8Jh5Ey7Szt2TNuas3HUzHDbc6I5RlJ4ZSw4aYTRt1v+n/lXVHa
 Sw+Y/FREj0x68olIHpGHLuuWtvw/mugOZNUCjwe45CmYxXeh6OYe73UkEvvnf9ehyWQY
 +SJZa0psKi/4w8GnUJ9ifhxWy83pdlI0ZXVTrmUSuwwa13R+t49CDaHKBTcl42SWlbio
 zmPTiQf1eGuE9ByzNSlSwsfhw+zifp2ej0YkdSJ5vMVfv0VN5Y2V46XLVXBWPYCZXVFu
 IX9YUJFFdSmCETszxDNV7dNPu8am4aavoYsqsvcAhCzOK7nhGJSqrkFc4AiU7s5+6Ciq
 ttIg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1687015139; x=1689607139;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=jvksy0Zs8edtbUaRjOtRIECsmgBu9zcu77ROzm+r5ss=;
 b=SpjsYaE4+TatZ6H/Mxabw6lfEltB9ExQneScjAwmoQv+Bwsh6/YeCVYrHb/8bkfIpd
 Bz2SnilKugYHoLUbbKi0BOWlyYwc01pyt4s8wCMeLh9QGq5ssTGi3rMiZahiSMsE/3lq
 LczDen3YIqvx5/wWcrOkklYWjW67eI08dW4DCmjSmqQW5WK/IWUlwgzlJF3PNxtYKaZp
 NjFtuyK7WLaa8qmwegKcZeSBiFpGATjIaMBAPMhk2zd2h72SGXgOIMVVkZsmCs05kZg4
 kfGpU8lxZJHoX3eo3w65WEPtDL+7SVe5Ehm1MbaPCn46snsavTt1U+mdKwYF7YUcACYD
 GaDw==
X-Gm-Message-State: AC+VfDzYgsuCpJcDU3OQSA95PyDcyzw8ALodmA1Y0tBzcwqY43dCDr7A
 ouaT/ZfIShsWiDJUoyedeg4meIvJLHA=
X-Google-Smtp-Source: ACHHUZ6TCmfpoiVXJiMUm/WKikciI5mqOaJ18T8tZtf3DhGYWp8vYv/x2s8XPrnXJDkx4JhHLpfWAg==
X-Received: by 2002:aca:6106:0:b0:38e:ca21:db29 with SMTP id
 v6-20020aca6106000000b0038eca21db29mr6780173oib.27.1687015138865; 
 Sat, 17 Jun 2023 08:18:58 -0700 (PDT)
Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar.
 [190.225.105.197]) by smtp.gmail.com with ESMTPSA id
 j189-20020acab9c6000000b0039600e3376asm9533452oif.1.2023.06.17.08.18.57
 for <ffmpeg-devel@ffmpeg.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 17 Jun 2023 08:18:58 -0700 (PDT)
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Sat, 17 Jun 2023 12:18:47 -0300
Message-ID: <20230617151848.1378-2-jamrial@gmail.com>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20230617151848.1378-1-jamrial@gmail.com>
References: <20230617151848.1378-1-jamrial@gmail.com>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/evc_frame_merge_bsf: use
 av_new_packet()
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20230617151848.1378-2-jamrial@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

This ensures the buffer is padded as required by the AVPacket API.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/evc_frame_merge_bsf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/evc_frame_merge_bsf.c b/libavcodec/evc_frame_merge_bsf.c
index 827f114f0b..540bb63631 100644
--- a/libavcodec/evc_frame_merge_bsf.c
+++ b/libavcodec/evc_frame_merge_bsf.c
@@ -114,14 +114,14 @@ static int evc_frame_merge_filter(AVBSFContext *bsf, AVPacket *out)
     av_packet_unref(in);
 
     if (au_end_found) {
-        uint8_t *data = av_memdup(ctx->au_buffer.data, ctx->au_buffer.data_size);
         size_t data_size = ctx->au_buffer.data_size;
 
         ctx->au_buffer.data_size = 0;
-        if (!data)
-            return AVERROR(ENOMEM);
+        err = av_new_packet(out, data_size);
+        if (err < 0)
+            return err;
 
-        err = av_packet_from_data(out, data, data_size);
+        memcpy(out->data, ctx->au_buffer.data, data_size);
     } else
         err = AVERROR(EAGAIN);
 
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".