From patchwork Thu Dec 9 13:08:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32244 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp343380iog; Thu, 9 Dec 2021 05:08:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJya56P4vCK8eIWHbRq9vc0oiCDSvN3c0syp5B8bmh2uTxdg7r/wilT4LJMDl+kMpVmzggah X-Received: by 2002:a17:907:d14:: with SMTP id gn20mr14770214ejc.73.1639055320600; Thu, 09 Dec 2021 05:08:40 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id la13si9217729ejc.450.2021.12.09.05.08.40; Thu, 09 Dec 2021 05:08:40 -0800 (PST) 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=@outlook.com header.s=selector1 header.b=os+melLA; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E0FE768AFDE; Thu, 9 Dec 2021 15:08:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2019.outbound.protection.outlook.com [40.92.89.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E908B6897E2 for ; Thu, 9 Dec 2021 15:08:24 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cf5rDyhnsvlb25USE2sJI91kC8Xs3wLKjiIs78PRrg6oqBr17u99LQUQ6lZyovuZ5j5Cq9RFGtFghmjB1D29cK8lF6StFStU447JSSPMQPqgp1dz2lyX96OrHHsySIyaoTBcmnbA74KqlrZ7QqAwT/9ZCXA7WhhnbJ7/sob6NC0h4weKBsVU2BykR0kIj/+Kn3nnZONi5DMzXS9zcF6sV6jq1xhgtjTDj0cmhkLqOhrppEU/OkIZ6c9pgmMq0kvZ+jRhx3VAsjpMj1t0vVSkDYURrBMC/k4FcIMIj3inr25w11GRb1yeFG4TwlJP1TQQoz4VZSFDecm0+8OSgCvYVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sb+ejQtI+AzTggBOeOcPUvR+dFU9cGuTdWTEJHyd6Xc=; b=SKhFyWp8eZWUkxs4pqNh6Yif+KoB4+jkpl5OCgOqAzPFBmSQeZNpcBPq++gGn2/5BUF185Q2vuNGAdLLn0m/MgSbPplBz2isIzP1wYhNq3/89Z4bF+twQTuETZWQ14S/rQJa0tZNzcaCwZ3Jvm+61Y4FqnK+9YE8nZtFPgG0G3h09fn0hpQkStFddeQokZHLyAlOQ2PAAFawZW1frw6x4hrb+ZBd39ld92aWpFGTr5oM1bPPimiWFKH/mj2i2XHyELwh0iDRlA84KEHDcD9egrqw1wtS5YFgQMPLfF9WivLnXzn/rf7k08jYrYbHvCEE8zZ5HOspJZeaZHMD/5x1eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sb+ejQtI+AzTggBOeOcPUvR+dFU9cGuTdWTEJHyd6Xc=; b=os+melLAQGelkLVXUk65RMQEuOkXCIQ8x6JHpVeZBp7ubhmAZY1XCZl6BRRyaVNWg4GBaIs5uaVvWW+Zpka8rUeLKs6wbtu80LOY8TiiC/jls3cU/sep7CmL8IcHrqUa0ueu3RcNdhCZRms1OqwVZpSORdC17MDFJPH01lx5iL5SUSJgY/m/o6UCM/Q3SIZdZWWGuRroRQW7Thx9MBS+aAodMLAg7DGGXAtKsS1Cxs1QNdUzDV5vE/7SD7NkMRU3LchLgF8chetjpr9asjFhrqqhrClZOHzXgv7ByQFlFYmOpGkHwg4LlwQT9dmOx/cHPL67YW+cBnxL6maBwhrUHw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR0302MB3400.eurprd03.prod.outlook.com (2603:10a6:209:1d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Thu, 9 Dec 2021 13:08:24 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%4]) with mapi id 15.20.4755.025; Thu, 9 Dec 2021 13:08:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Dec 2021 14:08:02 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [5s86yf8xykKy+wxEqqqeLyB9uOEdc9er] X-ClientProxiedBy: AM5PR1001CA0039.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::16) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211209130805.678224-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.248.74) by AM5PR1001CA0039.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::16) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Thu, 9 Dec 2021 13:08:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6342d79c-d1e9-4610-e49d-08d9bb14fb31 X-MS-TrafficTypeDiagnostic: AM6PR0302MB3400:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MNV6PhJmIcc6LimevaltEUvzLD7JZ8MXA9Ts9a21aARJzOPUl0ZxLCFiLUAhQrZDpZ2VieU2fXCsMH4wcwSaEvgUGqWdWjpPQ3gQ8YVqlte3EvrotqGsn1TjtfM1UkAamZiwEmIGn01jjLAbbUrbo+dM2vaMha1wV44brbrjnF2q9twpuArHKilFS7exfExD0rAMhrTKMfHsntjuJhBxehUWI2i8NBBZpxrwGpEMayKAS2G49bUC0dS1yKTPDgicQVLc+S+jlr2zuQcFX2sORWIxFNLRKjFd4wbqgoxFYYtaGsi6gNBDhqdYU8HyYgsI1xcT0dwxGe6REAP+2rmM/vjcGl87RPG0rE3Pcyq7AMdiu+4FRebQkCUfr48sldVfg+KpfLx1FJd7B0WKPMseoJaoYvP5S8gK9aB6wXd1jlcEEX+odw26ba4VRTAA/16f3uEoa6l1oYvFywiDasgW5QLoTLMNiwC2KPZW0wBn+U3pnW5w3Vesu2b71r/Y+Jbo3/kPeO3qVBmsHKXAQQA2LuUimH2XHDmMIevINrvB5Q9puJ/HmmPOwLheuB2vTq6H5TZ326YJ68+Zl8LqHdi/Nw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eXzhecG+/b0Bh3B+4KrchvUO97xzi+HRMuYJP+9R7ykLgYq4JUaupQsKq9JYcGf0FLlC2TQeWQuiXKs4K9V+akg258seFsxofe5kkyhdM4UOLoFyAiLES293MyB6lSGaxpLS3Q1AGW1RpbsjdWwdYhVydilLPm0WSg9bkUZ+D9OqL3Tpi+Tv9AUzzvQfJ+e9PmrzZclYdhZrkDUGbiS6dJGgEE8cljvDosJcIMno1m2uFTN9w9KCAouoOKTOvsdffD6D31nzVoZFJaQWeunkhD51dTw54BWZ/hDAceh/H3QPNe/svWhEqieoWJ5zmihOT797L1MJGR2tM9WhBkF78PMqYYy+lBAez5MthIrkUzvpHUrr5CelgVhI5D9lFk5Y3BO+aJ/96Fmp0iFzGY9N0BRTcCaovxHEaUoHVSuxNSK6vWLGpA6C0v1bAT2OJ0xk+HiuQLWNaH7GZg9pRO2cUggM89X9ni9AFon8DJ71utLiRfEOe78g2iSyXKmEk2Muh27KkzjP/N4xoiELQnx1/ELVndlY4kzEpJRj1D6CNiwK71VJla8dSC3skWWUZZr3eJVXdTNHrDy41X3JVjvAiyLE9t1+bJrFmY8Mi2FeY6zDmuOgjBVSU4sJJEliMFkKrugEUpw/fhbP58X8T3kp1ENGmY+xruW+UEUYbvODGwANJCxUqrxa1rQcOosL9NM5ba6PNnw4xik8vMyQjo2wbYSrFEHPEYXI1kOL5maKZT9HpKM4/73O53kxqJKiezHy2Mk0re7bUall2ZnJQw7B7UWgDvfdkLlP7ocg3UYP+F8LFnGb7XL26vsYXbi76A8V521gHPik0H4QwNcL0BPZYN171L/Ynxc9WjtBFcap7FI79WK67XejhDPq1ljOuqXMGScKyvSTqZBTVetplW7D2/a1+diuAnALUPgAXkb+wN/HVbZQkZUaQQBOdfCOCPrJsA//RyQm9DdIX7Xz0U7bmw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6342d79c-d1e9-4610-e49d-08d9bb14fb31 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2021 13:08:23.9914 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0302MB3400 Subject: [FFmpeg-devel] [PATCH v3 2/5] avcodec/mmaldec: re-use AVPacket for extra_data X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Ho Ming Shun Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3PJyMiLeic73 From: Ho Ming Shun extra_data and normal packets (from ff_decode_get_packet) processing do not overlap, thus we can re-use the spare AVPacket to send to ffmmal_add_packet. Furthermore, this removes allocation of AVPacket on the stack and stops using deprecated av_init_packet. Signed-off-by: Ho Ming Shun --- libavcodec/mmaldec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index d336f10350..68ecc68f17 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -782,12 +782,10 @@ static int ffmmal_receive_frame(AVCodecContext *avctx, AVFrame *frame) int got_frame = 0; if (avctx->extradata_size && !ctx->extradata_sent) { - AVPacket pkt = {0}; - av_init_packet(&pkt); - pkt.data = avctx->extradata; - pkt.size = avctx->extradata_size; + avpkt->data = avctx->extradata; + avpkt->size = avctx->extradata_size; ctx->extradata_sent = 1; - if ((ret = ffmmal_add_packet(avctx, &pkt, 1)) < 0) + if ((ret = ffmmal_add_packet(avctx, avpkt, 1)) < 0) return ret; }