From patchwork Sun Sep 18 20:27:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38033 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp858968pzh; Sun, 18 Sep 2022 13:29:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6x7TNNV9C9YqKKwa2VitA2CXIiuuOEBwdMynMw2LGqeW4aiV1CZ9z0+BE9vZ7hLljOVLTk X-Received: by 2002:a17:906:8a66:b0:780:a4d1:5a10 with SMTP id hy6-20020a1709068a6600b00780a4d15a10mr8966135ejc.492.1663532999007; Sun, 18 Sep 2022 13:29:59 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p3-20020a50cd83000000b00451b2b6ddeesi7017972edi.506.2022.09.18.13.29.58; Sun, 18 Sep 2022 13:29:58 -0700 (PDT) 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="hRL8dwk/"; 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 2113368BC5B; Sun, 18 Sep 2022 23:28:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2081.outbound.protection.outlook.com [40.92.91.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D37968BBEF for ; Sun, 18 Sep 2022 23:28:24 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X5ulYhl3YVnW+8vAc7IlanFUy9ECt3UUVvZ3rhE/JMsXUvDjepxLezHZtXWMgz7DykKyp/CRflJTveQifHbWYcRqlnf6KPWj7dgNfvd9vN8pS7y1fiH4E20Y/5kY8fYH35fEj4/CYA7kciSAcqYXXmWZ9viYZCdTBKQClYvUjX1zFcxcHFxHZ1elsTMIBjWsiN/2OQiHklaAm7+Lxe868gNcG015cNb8rgSs5RdoBI9geVrA9Pcip5kXfjGvkLuruigAMpEvUYpbCN+YlhUDa6yDTtXLtvai1Nv0OrcLarXBsSKu+s7m9mcMM5zKQWLSClkk3fUvk2xm7YbKMjtZpg== 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=pbyoo95FhtHmMIJkQXQKbuzhYHplyAK/Fzc5U/stfdc=; b=TpxAlxUAIBTt6FYvHCezv2306M4pE7ALSahfV0EeFyFlcVWMLQOUQ+5ICpclkEZTjz4GpqMUonTBn6+czJkOy3mGZ3PMRNUgVBAfwljtPy27j8y6RRAUyTw+xiLK5y+vC9ujCaGn+UlaT+5T588yWCnn5aQ1XBOvfR1C0MdYDI5NrXRPe36X1XMpCNEhJPkCe1QHnSkH1lLN8o6WKdzWKQNOPS6qYVD128ImyafiHaJB1AfG5ruxMwv//LunZSKJK9SxW+R7P4TQz+AumueP8jWgUftpnmBS6vdUXmI8uh/dPQE1IxtTt66GqEqZm001dA3tlil7UOL6uQVdJU757A== 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=pbyoo95FhtHmMIJkQXQKbuzhYHplyAK/Fzc5U/stfdc=; b=hRL8dwk/nfQyooLITIs7OZkbrHWI33VO9Xv/jo5JQz7jRS9y2toiJcXDKoQpEyWc/G12rvrrCaP3iKhfW+TwgHSXvPiIfTfU8J1zjG3wEjV6YATbE3kk2wFt8CrJMyeavgbGQ7sdzYgOl/xShoRssmdey0qQLT1nsc0hqqFgFG3Cu1E6Adpl4A5mz2281IO+/zZdZ3tyzMi5MHdXsuPpd5k4P6bqLeon20b8H8dPFT+pPr1ToOB8Jug8ZMFuu9CrOfWPVrZrMvRWiWXQtdChI9FBqM87h28Vt2vizZ6qiwdKE9lbGkRvzStzSsu3GYZIyUTrhQniCumOGhrQ8eSxEA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU0P250MB0484.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:34c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.19; Sun, 18 Sep 2022 20:28:22 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::f3f2:4362:56:4785]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::f3f2:4362:56:4785%7]) with mapi id 15.20.5632.019; Sun, 18 Sep 2022 20:28:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Sep 2022 22:27:55 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [st0C8UKJIcMPTCyKRwxI5ZibZq91W/tU7NdBg64utfA=] X-ClientProxiedBy: ZR0P278CA0109.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220918202757.2345415-14-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU0P250MB0484:EE_ X-MS-Office365-Filtering-Correlation-Id: 16fcc432-5dda-43e0-b9f0-08da99b4550d X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKxCM1OeU4RWKrdQhmMVsaYvXNiievAkHnFD/eRxXIcQJg46daxrQSAPQKwKfpVVMEnzCU3spYWVoRw8lWcoyKYX3GZExNNLHt4KHrgQz4qF95gX7YR8J1EGs1pcVpLu2Q5E6r1ddgrtlm/7s1ytZ2n1JW3v52XQPbhQun4vjKI2PTvRRUlWzeNTQz1g91neOBvTbGmsgz4Zipja+s9ewZY8V1n8jO1K5O/B5SjcDdgKA+QI62zJp1JGnrKqYCa9KiXJh2g/FPMJ8z57Krw8anUpMVFUa3SlpbK5Vf/MkZOXZxGzDdNmOM8o/GujnBJ/R18k9dGAHJMcGHujmC4NaBqV0BFuofGAVN1NmpoHaODl7cvP7zoCApRM4xNpBjmpgCFx0NxmFSwzx//Q+AxlbrNV5YFG2fNEmQnFxAyWscKGSfomLiLSEiwLrns9Y/QXmI6Tvr/pqGxwi3gfDxIZzSweJNE+V2r9EwRC5Vsy3h0FfWfhU7miyOJH5dOU4EBes4lN9jRSw/JNQoq79J8IU7yDb8oZwJ4fXPYkNIAsFrCzGC/WSOd9mKnioSxoVPKzpLTPsT1zfRWH1MvjTjAqNQdQsErZbT5qvDNiQcVwTKmJ9Jig1SDwzTA4dgk5TWd48ndWOXIxtuniQpOF22TxUgK1xLCgqomv2KILUnjm1gfVjpjfDqbZ1FxB1cPWT+9KwIVxRYOlNTIN/HtK7LA5l1A1ilwYaqm/J5I= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rya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Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2022 20:28:22.8347 (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: DU0P250MB0484 Subject: [FFmpeg-devel] [PATCH 15/17] avcodec/mlpenc: Remove dead channel layout checks 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: MQ493SSz1YgW ff_encode_preinit() has already checked that the channel layout is equivalent to one of the layouts in AVCodec.ch_layouts. Signed-off-by: Andreas Rheinhardt --- libavcodec/mlpenc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index d2e28888f7..878c5aedc1 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -27,6 +27,7 @@ #include "encode.h" #include "put_bits.h" #include "audio_frame_queue.h" +#include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/crc.h" #include "libavutil/avstring.h" @@ -602,12 +603,11 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) }; int i; - for (i = 0; i < FF_ARRAY_ELEMS(layout_arrangement); i++) + for (i = 0;; i++) { + av_assert1(i < FF_ARRAY_ELEMS(layout_arrangement) || + !"Impossible channel layout"); if (channels_present == layout_arrangement[i]) break; - if (i == FF_ARRAY_ELEMS(layout_arrangement)) { - av_log(avctx, AV_LOG_ERROR, "Unsupported channel arrangement\n"); - return AVERROR(EINVAL); } ctx->channel_arrangement = i; ctx->flags = FLAGS_DVDA; @@ -640,8 +640,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) ctx->channel_arrangement = 15; ctx->thd_substream_info = 0x104; } else { - av_log(avctx, AV_LOG_ERROR, "Unsupported channel arrangement\n"); - return AVERROR(EINVAL); + av_assert1(!"AVCodec.ch_layouts needs to be updated"); } ctx->flags = 0; ctx->channel_occupancy = 0;