From patchwork Thu Sep 15 19:28:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37941 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521096pzh; Thu, 15 Sep 2022 12:28:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5D6n6u/tCdE5aZQfXga4EWHrwaL3GN9+jqVthZsFHgpKg1IPvHLesu9FQteTe9LqVdbs/m X-Received: by 2002:a17:906:db0e:b0:77b:82cf:54a6 with SMTP id xj14-20020a170906db0e00b0077b82cf54a6mr980891ejb.691.1663270130185; Thu, 15 Sep 2022 12:28:50 -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 x2-20020a05640225c200b0044e7371f762si188266edb.260.2022.09.15.12.28.49; Thu, 15 Sep 2022 12:28:50 -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=mCzeZJG3; 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 03DCC68BBD4; Thu, 15 Sep 2022 22:28:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069055.outbound.protection.outlook.com [40.92.69.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4AEFC68BBCE for ; Thu, 15 Sep 2022 22:28:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4ySZIirVzkO7PGaC2XNNPCa+r0DrqnqdJ3DK/CUF0cqdQ48duIUTjOO57qj+AdACTNpLfrUlU9Y3oMrAakvHcFG1axlOxEurFkdAwGfNkxc3tKvqmaKg8AhtsodIrcE3oDKblp5PP1o0CpCQu1hcOSwNGQQ7TqyQl5RLzQwYjOdAlWYe7hIk3evXUyVaGF9T1mNLryaIClZjp0wFaT8DjlFf95WbNCm2Zep9UmB6dd+y+uAy1ZKmcne07Y7Av7SxXxlhWAifjFe3EC+7yivLceEg1r86J12deuBdg2inH7vRwf/ssv25j5iEenYSxL6T7jDduWiTRtNYmR4dBydjQ== 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=/Sjxi3JNdX0gW4KtwFZG2VkZ7M9EIC/OTQ0lb/xjzaU=; b=gsetc3hr9Gp9uLcs8eCsTiZO2e+Y/WOpnVHuK1ZRdADyPcwYhqPUi5AbEgG/tv0AZ56jmfRIeCcO8MndV2CkiVmU/WHLdzt4skIKe3QWINVktSh8gAI89LEFlOiHrk+oCQbKcABdAWBNTWRebDgRBpWkX25awqjJ6IyMs8HBe46lcNoLXTZ9yw+TrWs1olQHJTBVNUZwSa7MXAD/AT620y3/q941hFrmgWzUUCv+WCgorehW37IuQr4bXVxoVt6c97eCeV42Srafb1vb2JF7+nwt72X3QYUc0K98UJJbN51gY6WSM4V934ubPowtIvKE57yPSWCAaOj2yqO2R9UBag== 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=/Sjxi3JNdX0gW4KtwFZG2VkZ7M9EIC/OTQ0lb/xjzaU=; b=mCzeZJG36ej3lAnDX88J1R9HLc2IqEJ+vQD49Qrdnk/cC6HlTuZEnkjqOckEfMc0EIRC487JadfiaHEELIRpLYceQiOd+R2ib4AyMUg9YsVIiHUani4QxmXpBpNJh/yKLI8LlkMDrZN9sCiJrtGPbNDtaEHy6gOk/7qxI7c8OfirUVnTQO4oz7sNkYDwDxruO77azQ/s0VRIBqx3YsaqGeKkfE2QO+9qcVdq7/kQPsT2goM4n2HIdzlTXbLZQ8dG8IvLCCdJyiV6rDzbM9RoD5n83IlxolEXHTR+oTPjvHF86g3Noufx34NNK3sSfrp/SdSq2R15qFousbNck+yPJw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU2P250MB0014.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:2b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.15; Thu, 15 Sep 2022 19:28:26 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb%8]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 19:28:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:05 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915192809.2761301-1-andreas.rheinhardt@outlook.com> References: <20220915192809.2761301-1-andreas.rheinhardt@outlook.com> X-TMN: [gT59RXdiSGK1Kr8KBJdMTy9CsuPiOqhvUZF2yWjt3Js=] X-ClientProxiedBy: ZR0P278CA0117.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220915192809.2761301-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU2P250MB0014:EE_ X-MS-Office365-Filtering-Correlation-Id: c65eb3ca-9893-49dd-ee5f-08da97507661 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nhHBm6ef2k4kg+632kkxCLexQyH6wH/3mpt2DahJYWpc8VBtm3/GS6wtjh2V8hhU4ybkFFD5IJhnk2J5vbkhIV3zEXSdon8V14Y7sBVfI/pJO8VpTO8TiseCqZrzlnkohlE6Fiwgz6vQIshjzAvdIdmW/w6rjBwnwT6g8WNyMfAHPvROiAyoA9uKZFJYnG/QuHs7wMeVS5c/AApNIySwKCx75PHaLbQi4Teovgnx86RibYn87PzY6GF++rryXUldXtML9gDjmJXrEGWBJ8Kk3ejWizp9iCY09C0bNdgw2jmvH9L/DW5UDDwJJDcJ38032zk9P+IXC6o0J5eS9ZBIhZaBBGQRjYy6tAc+bm21qJQusJiM5xBDFWkiuZQV2wF6mHB5771fqb3giQ/T/jHR+9URzlv3U4X5/GfsDl4nHGk1oq+9jcZvYezL/jXcHxCXsf+3X9jXz53Ts172d0i/F2K1WhgUGBpVzalXm69T779Q6RYRtCvegLJvbJYB+udwe7zztOnvBc8e7Yj+bIKxP7keYKh/GTvWvpfcIQjwFlqSuWtU8c4Srd5GfNQsHxXJOt3uXPAwTx1WMAcYZmbTf/wMXLaxuGfvw7tdcxr+PKv2j173GJSSj8wlJdDYPJTSxZgwOfugLtsQXb2cTk5Tt/TikXSpuLONijEOU+k1XWSr5bmpMfwS+7ki5SwfdsB0WB9WQesg47pP9j608JwFAT4uxjW48RTMygMykbFQIcx9LzMVArjelgjAl/TAPRzaLJfK4yCdlLj/xC2yzpn93H X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7WvWbBf7xi51i1HUIoqGu+A8IS+60I4neMJdhPaXU65jU5itI0cD5K4ZqgfGpvml7ARNJ46/PbjJVMtl5+f0KW9psC1a1ZPH6dy/jkmRmHcBuLYHa6BNaePphyyV9qxV2KX2kXjJf4AESYsSG2b2IaXVfIt4wKpsE9TsJa6EbYeqnaODWZSAygVhdIXN6ZBadRyCMBgGRbR4P11lQX0A6WQ87oVZXGmdQdfLUyyUazouC5p2slMqdQ2QxYsc8xZ+LVqy+k3z0i3mKzr/w7hvzokyPPtWRGDjIeb0FPp6GX1wZ5PBgOZduVpVDIqgzk1dLe9M2slaBfawqUDa6jTUljqso3nlf3ScxKOj9M2+gJZw7Uu8rg9hHk/Mpci6OmXP4rQjTEDWKUUriwGa8IpSaOVVcwzceBAZUPOR8WrvvzAu7mY9w8e+KER7cCcbMZFiaVWqRxgat2obhGfI277XaMEjlAcbCoyoIoQdKlqDTL0uljbX8gIK7lom16e9bnpJi4qBXkzJW7e28J+Oe4gMpHRd8IOwXBYxOdgf7HK0/6XC8RFysiCc8TlK1eD3P8uhEbz32imqM7wwHKMTx11R0urvx9DtZ7C9PxjOKKv+o5hNRYFq4db4bVZA90mRmp02aWYcKjH2W3DtApL5XXiGRw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pcv4ghndZkgWJpo+m+hq1BzUyWYkZGQB4OplQDWVBz8V1MRArTDt3UK87dgSd1K9/TDf3Gf4RZv1akHXk5Y425NLnhGnCMIzmLTiKpyWYLP0Vx+yB2C18mjz2kv4a1QsXCNK9AXLDfkWHJMrrcJszme9oyaXI3vk2uanrzDXkhI48Hd3UqC/aAE4n9RCte1kiD4Wz9AcJ5iWO1SHhXqPlRONXutLnaQlkLugCbItqYIJFlrVN7B+/61kruIgaQWjFrr+fJHEp79I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X-MS-Exchange-CrossTenant-Network-Message-Id: c65eb3ca-9893-49dd-ee5f-08da97507661 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 19:28:26.7840 (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: DU2P250MB0014 Subject: [FFmpeg-devel] [PATCH 5/9] avformat/aptxdec: Don't set AV_PKT_FLAG_CORRUPT mistakenly 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: 6bJle/UEPh/3 Just because we try to put multiple units of block_align bytes (the atomic units for APTX and APTX HD) into one packet does not mean that packets with fewer units than the one we wanted are corrupt; only those packets that are not a multiple of block_align are. Signed-off-by: Andreas Rheinhardt --- libavformat/aptxdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c index aa86bfe330..0637a8afde 100644 --- a/libavformat/aptxdec.c +++ b/libavformat/aptxdec.c @@ -74,12 +74,18 @@ static int aptx_hd_read_header(AVFormatContext *s) static int aptx_read_packet(AVFormatContext *s, AVPacket *pkt) { - return av_get_packet(s->pb, pkt, APTX_PACKET_SIZE); + int ret = av_get_packet(s->pb, pkt, APTX_PACKET_SIZE); + if (ret >= 0 && !(ret % APTX_BLOCK_SIZE)) + pkt->flags &= ~AV_PKT_FLAG_CORRUPT; + return ret >= 0 ? 0 : ret; } static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt) { - return av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE); + int ret = av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE); + if (ret >= 0 && !(ret % APTX_HD_BLOCK_SIZE)) + pkt->flags &= ~AV_PKT_FLAG_CORRUPT; + return ret >= 0 ? 0 : ret; } static const AVOption aptx_options[] = {