From patchwork Thu Dec 9 13:08:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32243 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp343101iog; Thu, 9 Dec 2021 05:08:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJybsqshi9cK5C7GihA5iPVTnR9JMxlL8SjCmGDl1QLCsaegHm5MgfRsvrF6IOC1kr12bO7R X-Received: by 2002:a05:6402:27cd:: with SMTP id c13mr28590263ede.57.1639055308511; Thu, 09 Dec 2021 05:08:28 -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 do13si11023804ejc.780.2021.12.09.05.08.28; Thu, 09 Dec 2021 05:08:28 -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=sNs+jUXy; 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 CC6D468AFCE; Thu, 9 Dec 2021 15:08:24 +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-db8eur05olkn2068.outbound.protection.outlook.com [40.92.89.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 39CF36897E2 for ; Thu, 9 Dec 2021 15:08:18 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cIPI0WHiRdgJY8T04CYkNRQpgz41TYO6ogr6GlgZrDUdkcZXBiqQ8DfXUq7P7XPh0Nao3kUekbuFwciKSusdQjl65JaS7gI/SHk0PtcipGZ3eykvUu18Qz3wcPuHP0mgyPaOLac5VXNL9YqdWhUbQs8rMv4bcuPhMcYB1JC+izwwWNx5vR6JCpq31ZxzsAeTcYvHYaId54B9N8R4LPlW+jooj39J4oSXqf/ULVugNlkfPeEKX4Nna1C3yMo9spgYjsqaXqSHmvrQDRoqZP+4QasCq3Y7Fz6i5i/5MLSnVIDL7UFgsb527HUS+f2QYWJr6hUlnHaozdZoQ1vBOYDR9w== 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=bfsh0aGT+S16A2RfO8Kmy3KFyI6BVmtcRkoBeAuUVEI=; b=oMDt3F/EEtl38hHB+Xy8ApJdGpdlCf+3c08WgA65PBb9koMl1evHJpHrBDEWs0CIY5vTsulEJnNx/AMwf9NWl8ADezWTL2PllljoSBAiwoaycE4MQDT76BNq1xEvkbdmINAf0xSqpM4YRFyCLp4Ce7mHPAdS7F8qNRm55H2h8QCJOvcU5QTVkkf+r11Evkg2DKznMgSeAxmgm8To9iHhLzALJsyiuRfy7OcSqH7JgogwzeHLntuJvicfUHSSXm0L4oYuTLZEcR6KKmvRhpx7/gkfwQFX/BCN9r+n0BiAOK/sYvE2vLV1Dc4Yfvk4XBCwcxRv1HCkyDJg1c2mevC20w== 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=bfsh0aGT+S16A2RfO8Kmy3KFyI6BVmtcRkoBeAuUVEI=; b=sNs+jUXyGtkBkgFx5ny+HAC/kwrPD7BzmWFpgHm70VKJXZiCJKaN/aM+WT5xGnURWr7Oztgi6WNSQdqbBWfZRroSVIqwIStfHCnxPW010rHT1XbryD8NaKshtX9YOkPtq2U9LhSjZdNvzQl0sk7fSCvpeKcf0HxCB34x5VaD9/rHLz5+EW/DoXlIl4AybhitQr0FhsgrqLAiggDc7x37ivqmGL+MB2wbSqmLUiiAM6upLYo5TmyXzQBVYrDTCVtDMUulX1VnfksAnLCZ4mS3c+oN9jzxMrTBDCZWrswORRC7P5ifkT8rrwcL8B59wMsJwhdoCR2oI3hVOjbLJhntlQ== 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:16 +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:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Dec 2021 14:08:01 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [NkMLvkph2Cbvy1jDaL11DVGXF8cVSuoL] 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-1-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:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d94b3a1-2aa2-43b4-bc57-08d9bb14f6b1 X-MS-Exchange-SLBlob-MailProps: mBy7Mai7yE5TX1J4zfzcjryh+3QMv6knbaPSeRZOoQcu+A3r647Brd3d3AvMnoSybIekQxEoyUUHBF162/3AXmigV1mR5kjWcuGAaQ9ryVwrWrrD7h/d1okCiMK/afn/3as6K2CMdrQy9yGArUSsY3GQXEM7bJgYB/QbaPrZyl9Kt4zn3yyTCMWMlowkSEIZLDIECNr48e7BIuSCjp4JK181aUMMqByLLZHEKjWvYTctni4CzFtnwbzxFUuEoaVd0l8bRlxpw5SEakd0pQvW3CAY0NWRlBm2t52rgYRZOxv+BktCrZp25+lbgq2OQgbNeMgpz6sXcNS+2kqn0JUFnHl581EgO12+fTDIshoR/BYUz3DI1A3XjvMr0deXKBZpHq+I6+2W7Sgtf+FFdFDactPTsKjegbQ97tmSTDVm2UGqQdDUwFJj/9OfX7w/2I4hJxCOwyaR8lc2TPXetR9tdpr5LamJTx2gTXswmcbIe1h2OLrSP1+v+vkbrmLhMwohbtwYqyjT56GKpshzT3fKyi8q9X+AjpIYIWQcI3BRHfVc70XxftGTgyMKR9jWfBClXuRKz0GFynk+RCTT/vLwsJbNC+hkUGugI5SURr/eUju8T1vuVxpOODHRfaYLfr7mgUljqGOyaCXXuFhgUeoZJACJSeNi9OyudLBsv/9k//XwuyRIHaF2zwDRAacyy/z1udkVkcyjeAoG0LSrsM3tfA6gGr5Wg9sF X-MS-TrafficTypeDiagnostic: AM6PR0302MB3400:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antisp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xA5HTyc542gjozoe3HNH0fakGo8x0yOpi/Z9cPNwGbp0k6jTpV9zXAXhpAsH6uuCecinwcCjR35randFl96SteSzP5smZo0TfIwv+kYA71Qheib3zolSNaviWYzOmTNviJgwGFhnZBbjUpGvd9qRJYuFChZLEc6AYvP5l7gJXDDf56vnTeRRqnnyjlbLwEyGX+4/uCREeAXHCzUhKlXKBw0lZzRm+2ndLdIhfa1WLT6BikoaKsYRU4TbabWr2kZRWD68owWsrE8t9DqbXMBkop08uh/iFu3CvpbMllUZWEn7wjP/MVypXwQEPS5QiZcNIv01Kv5z+gHFP1UzYciCylkUldsWTAD566CawK10bezZaBeLmkVwEK6C8WQL6xqS+AxxB8hh+xsm66oLxUp67CbOZAyO2oVIZepKOw8xzBltoMh1Ngr1avi9Fl/YOLOgkFULsd4BhkWOklOWKY5MtHalBgEIx/+G/rME9aDv7QMNJdFFwtKcPuK15cVyUEKgD3XTdPTp3MuBhBcqHgafyh1maKgMtoEYjh8p8dqfxETjdwr9dRIJyJg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d94b3a1-2aa2-43b4-bc57-08d9bb14f6b1 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:16.4874 (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 1/5] avcodec/mmaldec: use decoupled dataflow 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: Andreas Rheinhardt , Ho Ming Shun Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 8kNazVSN/M/m From: Ho Ming Shun MMAL is an fundamentally an asynchronous decoder, which was a bad fit for the legacy dataflow API. Often multiple packets are enqueued before a flood of frames are returned from MMAL. The previous lockstep dataflow meant that any delay in returning packets from the VPU would cause ctx->queue_decoded_frames to grow with no way of draining the queue. Testing this with mpv streaming from a live RTSP source visibly reduced latency introduced by frames waiting in queue_decoded_frames from roughly 2s to 0. Signed-off-by: Ho Ming Shun Signed-off-by: Andreas Rheinhardt --- libavcodec/mmaldec.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 8c7d749742..d336f10350 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -83,6 +83,8 @@ typedef struct MMALDecodeContext { // libavcodec API can't return new frames, and we have a logical deadlock. // This is avoided by queuing such buffers here. FFBufferEntry *waiting_buffers, *waiting_buffers_tail; + /* Packet used to hold received packets temporarily; not owned by us. */ + AVPacket *pkt; int64_t packets_sent; atomic_int packets_buffered; @@ -355,6 +357,8 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx) MMAL_COMPONENT_T *decoder; int ret = 0; + ctx->pkt = avctx->internal->in_pkt; + bcm_host_init(); if (mmal_vc_init()) { @@ -570,6 +574,7 @@ static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt, done: av_buffer_unref(&buf); + av_packet_unref(avpkt); return ret; } @@ -655,6 +660,12 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame, avctx->pix_fmt, avctx->width, avctx->height); } + frame->sample_aspect_ratio = avctx->sample_aspect_ratio; + frame->width = avctx->width; + frame->width = avctx->width; + frame->height = avctx->height; + frame->format = avctx->pix_fmt; + frame->pts = buffer->pts == MMAL_TIME_UNKNOWN ? AV_NOPTS_VALUE : buffer->pts; frame->pkt_dts = AV_NOPTS_VALUE; @@ -763,12 +774,12 @@ done: return ret; } -static int ffmmal_decode(AVCodecContext *avctx, void *data, int *got_frame, - AVPacket *avpkt) +static int ffmmal_receive_frame(AVCodecContext *avctx, AVFrame *frame) { MMALDecodeContext *ctx = avctx->priv_data; - AVFrame *frame = data; + AVPacket *const avpkt = ctx->pkt; int ret = 0; + int got_frame = 0; if (avctx->extradata_size && !ctx->extradata_sent) { AVPacket pkt = {0}; @@ -780,7 +791,11 @@ static int ffmmal_decode(AVCodecContext *avctx, void *data, int *got_frame, return ret; } - if ((ret = ffmmal_add_packet(avctx, avpkt, 0)) < 0) + ret = ff_decode_get_packet(avctx, avpkt); + if(ret == 0) { + if ((ret = ffmmal_add_packet(avctx, avpkt, 0)) < 0) + return ret; + } else if(ret < 0 && !(ret == AVERROR(EAGAIN))) return ret; if ((ret = ffmmal_fill_input_port(avctx)) < 0) @@ -789,7 +804,7 @@ static int ffmmal_decode(AVCodecContext *avctx, void *data, int *got_frame, if ((ret = ffmmal_fill_output_port(avctx)) < 0) return ret; - if ((ret = ffmmal_read_frame(avctx, frame, got_frame)) < 0) + if ((ret = ffmmal_read_frame(avctx, frame, &got_frame)) < 0) return ret; // ffmmal_read_frame() can block for a while. Since the decoder is @@ -801,7 +816,10 @@ static int ffmmal_decode(AVCodecContext *avctx, void *data, int *got_frame, if ((ret = ffmmal_fill_input_port(avctx)) < 0) return ret; - return ret; + if(!got_frame && ret == 0) + return AVERROR(EAGAIN); + else + return ret; } static const AVCodecHWConfigInternal *const mmal_hw_configs[] = { @@ -833,7 +851,7 @@ static const AVOption options[]={ .priv_data_size = sizeof(MMALDecodeContext), \ .init = ffmmal_init_decoder, \ .close = ffmmal_close_decoder, \ - .decode = ffmmal_decode, \ + .receive_frame = ffmmal_receive_frame, \ .flush = ffmmal_flush, \ .priv_class = &ffmmal_##NAME##_dec_class, \ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \ 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; } From patchwork Thu Dec 9 13:08:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32247 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp343978iog; Thu, 9 Dec 2021 05:09:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBHz3fdWQdw9q+yu31DfMCyU2x8tW1TlwZxWpz8RcYQ++WNUGpvEFy+pD7QPWH5UX5AGPF X-Received: by 2002:a17:906:fac1:: with SMTP id lu1mr15650137ejb.171.1639055349757; Thu, 09 Dec 2021 05:09:09 -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 x17si7212438ejj.1.2021.12.09.05.08.57; Thu, 09 Dec 2021 05:09:09 -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=huoNDAQW; 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 74C4E68AFEC; Thu, 9 Dec 2021 15:08:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2082.outbound.protection.outlook.com [40.92.91.82]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0780C68AFE1 for ; Thu, 9 Dec 2021 15:08:50 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKY7rINv1SGXrGPECGsGu1yOrLmWFwxm21XzsA4hEg5k2/Pp7qJE0ziayZ58BogPmFXnm65Hq/FRFUmnIV6181vX/2p88YxvE3RIjgYSSpu/PScnQOzkCBTQXv1uGYUOe296aT5az7N4uUVjSgo9q82KQtvqy5qMBXa9xDmWrRLKHfder/aObgUqh+IVqc/NrcqEWenzKMaWgbcxvp4U1zMMqReRzM393ZYVYvyR22dJamjKG6HwFpFVFEWyXiEu56+r7iIlrItJNM9BilmITokufz1UW5MW10jJc6lUbFUM+m4Pcwr/CGyA8fK7Mri5x1okAfDq+2Rc7ukbQ25kYw== 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=5aUX1RQJ85W5NqACk61EBFtbiniU9DBnjLdJL+BWsRs=; b=fUVZMxYLpX61wuNFB1jMUbTo13IuCpWrivnG4MhUj+hv8fPUGIosW2JFO+1z0q/PnDsls7WW+6ZoPTlr95ZVhu4ovcr7vw63uynbiWc4VHXkEUgj3YknVDMhcowTx7YnKQxGvxh8bTJM9Ga8iGO8j/Yu1kAoXJUiUyx44aYfdmWDQnk8FqQ+TZdj3lBVQy0KWrhkwRKYUjEWPFD9C0ifzJ4VISrwHvVwUMzvihXqrLxqaSOIHweXHbXdZw4XLkLBkO346KzZ0ieLEJZg0cv5Ih5bDgCT+gU8qVDf6IIIaM+VMcUPVL86cN8nfUxInWJ3KODiFTHZbdRmzw8v75m0FQ== 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=5aUX1RQJ85W5NqACk61EBFtbiniU9DBnjLdJL+BWsRs=; b=huoNDAQWjM82KWl6/iAFl7lRMPvbUIylj1kOS1r7vW0CGnBrY7BHen251xc1sQ25tizUR7XeYv3XhrA1RcU/cGk5+ND9phcHsjiifxN4IPgj8n+YSRZciie+VDp/0tHPjhP6qcjO1tmw45/eYsxeHC0I+9ZgZba0cgGJ8K7FB5fRqzHHD7mDmUEuMQrffVll5VwkaqAs/ozlYpLU2SsWPEQE/W7BHvlXnGoETFYWEyncgkBGM7icSth7vxVtkll6167vCytAFprhSPh2UVHJDnLMvfPuuj8s2lyQk2ChnwMaxrPr5gGgJKQdHfYR4xP5/tR70f614yUUUvr9NDFnVw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3605.eurprd03.prod.outlook.com (2603:10a6:209:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Thu, 9 Dec 2021 13:08:49 +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:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Dec 2021 14:08:03 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [WZP5qj40MkyRayi146oPuLx4886l5yFy] 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-3-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:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c9281d4-3cdf-47a8-b2a6-08d9bb150a5b X-MS-TrafficTypeDiagnostic: AM6PR03MB3605:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n9uWv3B2mLzdpTcdYiR+I8JUZIWNE5A6CUJ9wMDdRsMh9m5pHV5xBfcVMJmjhJL5llydP8j06Kquwc6av09Y1R7whJRUYePYEoFI3CCNkcF0sfgYcu7uS9BFFzDLimWLwRM4LumIgMpwp7mYR0ZhRNUGkoLhlhVMOOoNDBGYHuLLyszoUTU11PVCSO76Szr8bndkSk9wqoYsrHo3rftsdRKgGARrS+0yCM7VY7SG/4R0bnsw7oMUPA6gar/w4Rr6NEcI8TH4VTysY82Np2jPkNsr/vVczCce7YGbTSbIaLr8so4dhkMSc0vqojowvQbWg7Kpa69apEEn/byiRxHISi6GRFIaqhlw8fIGEGMgkJ8pV7JnU9uhHdlAx/zFnUDGjQZHpZ7s/EGGmt6OoLMozVZHXZRsr1KzYuSNdPbcD0xUzs1Eu440nZWUTbxpsezSrVW5y8wFfsC3ktzk0VoQKun/qyG3TtSKmKIpRQ3TcwDraJzWdTwroBH88ccmsX3XR3j+JDA30w05Dd2N9hyNDR69nKg6pYFGtLDbuyarJ8sE3DnvLlhz78PXgXCepyyHQf21MuoV8a9k7oCh9zI4fQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LRdB/p5XdPwhWct6wlqFsPxtfKiC6Yc7ocJ4PdPGxpWZLGBYz7DCVHWJGUJzqyFw4NpO3y/7RSzq9weiTBXMKTJKEKYoXj/hcvmAaf7+13ZIlRdYys9Y/Z4TMwvkQa079lOdiGiJ1QUypBPjaSt+uompj4wKHT/Nh2714YPktSzjdughPzwcIPFtkS4dQcIyerXUNEVr3fui0XPIJ+CQq2Kdr1SGl/mudotihNXgnpw+/2u9ai7kfMEqggogZZAwu3p5Cqu5LAVdVctSYW0Au4Dm4Lr18bOTmk/1madxSxQrTRDzNovDlXIsSVrnehLmJscj9Eu91jkPSoJ/MU94S+soRHqI09nWemB0RO1zstcy4/nsTN+I8ORrS9vL3gnQX5HizxHfWe21lbQtN+xsKlgDmlAT9eD1cl+TGy4zUAUHgro7mJHuQWLBtQLfJKY1oUZlytUqNLay0MBqH4AjvUjZ7DiDA4w6Y4MC3/cQOvj+MPH9QdS4yR/giNcOmjN9J9/5gQSqGD+0YSwly1e1eJqtK7TiqJ3oOTpsQE8xK6lq/d14sbtcwqJRlf/K971xG6XBHDko2ka5m/kxSHJiSz6twqamqGsa22d7EdQiWeBtqU9I6stiZi0DVFhXEp//6+ZaYJjR2bFh83wHaLoaktoglFC7UWmhI5/5CddMg2sfpHvKIf1OzWfuFqgNZbc2Or5zk0BOufav/VulaDNbFv+2QBFhsD/LC76PfG4Wo3PCds3YoM3ZUAileth72WfQ5LvLwNJDMdly4jNdxMeZzGJQPyGlPgJUQMP/N7IwVfJGRVq18focpYvqknzCoZLhWYMa4B6WsgW0bAt8xLVF56S92bFG1iRODc8YP/WwDjsGKoOe81rwv3qvhgaNR/yF3oB2T1Tx+qJTza0K+DuxZ9Towy96VSXqISBXD0VdpFdwDTDk+Y8FjlP8C0DfohkTbdBNnBBNT3E3Sh5e/G6zJA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c9281d4-3cdf-47a8-b2a6-08d9bb150a5b 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:49.4780 (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: AM6PR03MB3605 Subject: [FFmpeg-devel] [PATCH v3 3/5] avcodec/mmaldec: fix pointer type warning 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: Hh7e8KLjomug From: Ho Ming Shun Signed-off-by: Ho Ming Shun --- libavcodec/mmaldec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 68ecc68f17..3e11d487ab 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -656,7 +656,7 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame, av_image_fill_arrays(src, linesize, buffer->data + buffer->type->video.offset[0], avctx->pix_fmt, w, h, 1); - av_image_copy(frame->data, frame->linesize, src, linesize, + av_image_copy(frame->data, frame->linesize, (const uint8_t **)src, linesize, avctx->pix_fmt, avctx->width, avctx->height); } From patchwork Thu Dec 9 13:08:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32246 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp344119iog; Thu, 9 Dec 2021 05:09:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7DHOTumgUWQLYq7owUGUhl9AbE70XodOtvMVPwxX+DN4dnACcI60i0IhvhmHnG/fo8NaY X-Received: by 2002:a50:ce4a:: with SMTP id k10mr29311074edj.31.1639055355149; Thu, 09 Dec 2021 05:09:15 -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 cy12si9755573edb.70.2021.12.09.05.09.14; Thu, 09 Dec 2021 05:09:15 -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="KRdcPn/2"; 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 00A7268AFD4; Thu, 9 Dec 2021 15:09:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2065.outbound.protection.outlook.com [40.92.91.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9515F68AFF2 for ; Thu, 9 Dec 2021 15:09:04 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J99xVXFSdhTWf7QxTxg36mzd3Ao6xsFQEQ3u/feWEaUPd97fRiYsa4lwR+YYicjz7MolDyxV2+g/DqXYiVVnPwPK+fVMhmUGQT4/KC/9m6KEQREiu3GcuKQ/3DSUXZkWkMp8OFiKb6n/+igFgYi9CUqav9U0H+n8gaiiJeJB5KybbpNURZwvQkyWBp4cMrCo0ZE1OO1gx6YzBvizc9dsVc2QV5oQdF2ogVoPPnOrAu6VGH5F+CnbTWoWEke6sI2MdlgH/PTzfhFk3DxGUwMxVI38qbt9WoRnnh1leJPF/CMVYcdFYMtMbTjpt9GMg6frjpnJNVIF4/jBEuCBcm93ZQ== 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=v3UkW8DWSPesGaOlIB4sjxm1AxpRyMqqo+GKzKsR9XU=; b=aS0sntj06FS07R3HZQCpR9aIzKxBz26s75oj+xcxNVlNUCiSWssjIgXv9vYpjM7W4sgbpUJxFA5z2Yy4tB5kaNKqsyQ3mkD5XLOzdZf1L/uczcR377dPoSaTCYB81sNb1gycjaR4J4FzgEjKRoxrL0BeeByAnMsfI29OUVpj0qjNeR9ADIn0x504JRy2PkD7IG2Ik9p6LcOZryCG5797/ykW4AprrYmAa2ztIg6AE3jn4mMC0gRUyuTjxiRGFf1mvLnarGCnJGd8Wk4vnHYkdZh9LxLZ7wzaCro4wk5mMUsBA3iYyQ8JpmmZfX6IwxiYy/IllO/yFCLYRJ/m5q3hmA== 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=v3UkW8DWSPesGaOlIB4sjxm1AxpRyMqqo+GKzKsR9XU=; b=KRdcPn/2kDUtoy/Y+1GQJFE8UuWqEwJ09Gi2UvB+j/r54iKmxjkXTzjx0hxSVFiO2QCdwaFroqVSCsUCBfZT74elX6QiFROSlY6zvnJ0yRuEIqvy5dx+/rgwwfu1aBJ+eWmiQ2olHcPYGRUTsnyJ/UN8ky6W/orvR6ZA8X6NQQ8QcVHj1mZoqamQOEtOJpsalXaZEYvhw7VLjfZNB1GFIs27EzvFF6Fi6SFgSioTnibs3c2B5VLTzU2EWIK9LoU2xYLIupMkUEwczf/S5ERT23fWoqkRIDefP0pGjrEKPv0MwBFetufB3APjmzGRGIMELqCIII1wl3ibZ1gxZ5bhHA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3605.eurprd03.prod.outlook.com (2603:10a6:209:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Thu, 9 Dec 2021 13:09:03 +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:09:03 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Dec 2021 14:08:04 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [whhpyOFtWFVkrYTTQCXX+/BhQvZH7w7N] 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-4-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:09:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27137809-fe9f-4646-bcb1-08d9bb151282 X-MS-Exchange-SLBlob-MailPro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OEHuzsjZIg9mxX/C3vzP4CHHsMFCLximcEldbBRGfmOAvH7a1WFTfxm8IEf+wBLcECKZt3U1Sq+PSrlGB4HB1EcOgb3SomnnZE710FtvYorVOYvwV6Q+oRBY3SYIYxvwrbteXScZt2e+sNlJYZWtKB6EDVB83OnrzA5zWa1bsBI1G2jgGThQ1u1lLvE4I65e1idtK12ZLyWYTm14cIVpN7VMiRgRP00KzsIv4yHNl2LGNi6dHIqqikn237VfMMCaOfIM2ioND42aeHSlWwzfUwOiQGHeFnTDuzCRRIdivrtKsV+svnLgQb5i8VRP8L/gO464EzCv8ZGteGX2QXzA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27137809-fe9f-4646-bcb1-08d9bb151282 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:09:03.3900 (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: AM6PR03MB3605 Subject: [FFmpeg-devel] [PATCH v3 4/5] avcodec/mmaldec: Avoid creating unnecessary reference, simplify code 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mo7jiIEtoyTM ffmal_add_packet() basically duplicated the logic in av_packet_make_refcounted() with the added twist that it always created a reference even if one is already available. This commit stops doing this. Signed-off-by: Andreas Rheinhardt --- libavcodec/mmaldec.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 3e11d487ab..0c7df0a0bc 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -485,29 +485,19 @@ static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt, int is_extradata) { MMALDecodeContext *ctx = avctx->priv_data; - AVBufferRef *buf = NULL; + const AVBufferRef *buf = NULL; int size = 0; uint8_t *data = (uint8_t *)""; uint8_t *start; int ret = 0; if (avpkt->size) { - if (avpkt->buf) { - buf = av_buffer_ref(avpkt->buf); - size = avpkt->size; - data = avpkt->data; - } else { - buf = av_buffer_alloc(avpkt->size); - if (buf) { - memcpy(buf->data, avpkt->data, avpkt->size); - size = buf->size; - data = buf->data; - } - } - if (!buf) { - ret = AVERROR(ENOMEM); + ret = av_packet_make_refcounted(avpkt); + if (ret < 0) goto done; - } + buf = avpkt->buf; + data = avpkt->data; + size = avpkt->size; if (!is_extradata) ctx->packets_sent++; } else { @@ -573,7 +563,6 @@ static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt, } while (size); done: - av_buffer_unref(&buf); av_packet_unref(avpkt); return ret; } From patchwork Thu Dec 9 13:08:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32248 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp344560iog; Thu, 9 Dec 2021 05:09:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHdMuNcp3UDjJEhJObh6Jxz7CA8w7vhhSJOC7qwtqfNH4BtTn69LRg0HfM5nosLrHdR30A X-Received: by 2002:a50:ec16:: with SMTP id g22mr27845040edr.214.1639055374899; Thu, 09 Dec 2021 05:09:34 -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 hz2si13408291ejc.386.2021.12.09.05.09.26; Thu, 09 Dec 2021 05:09:34 -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="c0/WyEyp"; 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 2D47468AFFD; Thu, 9 Dec 2021 15:09:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074044.outbound.protection.outlook.com [40.92.74.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C83E868AFF5 for ; Thu, 9 Dec 2021 15:09:12 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fR6YC6pFdLTO1S2Kr/d96heRYDwE8OQkSJNSk/SW4xVFb3JAGxyZHBqyf7kN3MZ4yYzttUDYWvjk9PQhy0bf+qcys3Gmn8niPuCYt4tLdhgHC3JNJM3171j51JrFjxYEUjpfqHrgFabnrnp+gdjeCjQ4Eg4t+gl3XNhYir02TkF3Xm9iCpIgCEbhe/hBWRmqeIQlBxSN7YZegnpcA3jT0xU3/HtY3R7LMDUFiCLPjfO7YEGdfA5EVG7BHRpipIOvGuzxGZ4f9WXw49zHyBnlN9+U6PtVccUe3Ci5bjGyXYr7d2EiA7BiYgWeXZ2IOKOW9j+kA0GwQ/4oL2/OFxbAEw== 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=EQQCNggKtKlPyqv+q97anTQB0fQFg8/Z7sPoERjuHCY=; b=I8L5xiDF9kPSMoYW5zesWX/4KlBTrI/l50VqWFpY7kgkWFpsOHmwHDTkdgrfruCNdg9I9fq4vQzbM2BTfardMIwrJnvqJOo2SMlBUWT3mL0lR6IPalrBDEvg33pxasJyHwSh75I0CXHILW5XTXgJXdA038x0LB+g4TnVg3IjePotcFKistBa7qZ+OTxqK/YPzK8ghqi7Z1MxJa2HrJ8D88tT12fgoSon/olQjLPjVDClorDIBJZOoauJJn0SueZfanKXrN/BvPSGMBnuxdk5MgA3IA4wqg7aOn8fl5U1HyB0B7/MtZmvQvvHMIriLRazI532sXBvJS7BJo2E/2NT5Q== 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=EQQCNggKtKlPyqv+q97anTQB0fQFg8/Z7sPoERjuHCY=; b=c0/WyEypGKdIIqr3kVBLvzCtQDiWK30aeAFOTDt6mjyA4dy1vep36aVDxo0CLtlcACVVGfyC88J7mIoPBr4Hk27BTzTRbhUkGlzuOycBDY95wyv83c/e8aGwzl02brEKHJ3LaQAwX/4/YGZytB83rKXjrzjq0q6uL2pXOdcNKz8lp9WRvnX0Fa4jPEgJPKOvnl7uLu+Vh4zSdmUhbcFmO3e2tDfsKl7PCRZYJhSp0RRUxZNi//bbumv+VK57DEaAvv351DxbgvrsMhXfky/IUra/3OZiik0QR9O8CYGrSBaxBYtw1kohr8jNiNWZ2glEtB2Mi1vOmzTumLqGzAmKsA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5048.eurprd03.prod.outlook.com (2603:10a6:20b:8c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Thu, 9 Dec 2021 13:09:11 +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:09:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Dec 2021 14:08:05 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [WT8CbxDRzNepTuKlr4ceTKG3C4gx+PNn] 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-5-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:09:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a95d3271-c18e-419f-2851-08d9bb15171f X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/ULftefJ12YP+O9+pfRyTL+Vzci/RoCiYIg+JZ0c5sFJkhR46vZYG1C2i2Vh/RudC1LqIqW5qcOIpKVIYfXNWZ71FSRcpG7n69dEOGahJRkzliOfI0d5NV+6Bk4us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uJBtoUXcAIEPPFENdC/wSjvqnPnu8I4kcl0CpdbAR047TlUNAHYahhrP+coIROUV/IEujbd13blJS6SCw5Dw9FTTcPN+FGeM7mL4nwXiVuJcGnTx07D4pTpNvpDd5EVkt2QsOMhH2Pmid72SY7ZP4/Gp99w4Vehl71WHng== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a95d3271-c18e-419f-2851-08d9bb15171f 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:09:11.0011 (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: AM6PR03MB5048 Subject: [FFmpeg-devel] [PATCH v3 5/5] avcodec/mmaldec: Deduplicate AVClasses 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: G6kEjfIjt2mu Possible now that the child_class_next API is gone. Signed-off-by: Andreas Rheinhardt --- libavcodec/mmaldec.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 0c7df0a0bc..f8a7319cd6 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -820,16 +820,14 @@ static const AVOption options[]={ {NULL} }; -#define FFMMAL_DEC_CLASS(NAME) \ - static const AVClass ffmmal_##NAME##_dec_class = { \ - .class_name = "mmal_" #NAME "_dec", \ - .item_name = av_default_item_name, \ - .option = options, \ - .version = LIBAVUTIL_VERSION_INT, \ - }; +static const AVClass ffmmal_dec_class = { + .class_name = "mmal_dec", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; #define FFMMAL_DEC(NAME, ID) \ - FFMMAL_DEC_CLASS(NAME) \ const AVCodec ff_##NAME##_mmal_decoder = { \ .name = #NAME "_mmal", \ .long_name = NULL_IF_CONFIG_SMALL(#NAME " (mmal)"), \ @@ -840,7 +838,7 @@ static const AVOption options[]={ .close = ffmmal_close_decoder, \ .receive_frame = ffmmal_receive_frame, \ .flush = ffmmal_flush, \ - .priv_class = &ffmmal_##NAME##_dec_class, \ + .priv_class = &ffmmal_dec_class, \ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \ .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_MMAL, \