From patchwork Thu Sep 15 19:23:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37938 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp518643pzh; Thu, 15 Sep 2022 12:23:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78gFYUlk9eJtumGYZYdwL4qsg0IsILCuvnDUkkQGNe6NFLliy2AwJP2GOWi3IZGywYZiM1 X-Received: by 2002:a17:907:1dcc:b0:77a:c5f3:708b with SMTP id og12-20020a1709071dcc00b0077ac5f3708bmr993716ejc.331.1663269829937; Thu, 15 Sep 2022 12:23:49 -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 sa36-20020a1709076d2400b007802725907asi5706956ejc.647.2022.09.15.12.23.31; Thu, 15 Sep 2022 12:23:49 -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=MIe9I8Rw; 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 9EB3668BBC5; Thu, 15 Sep 2022 22:23:29 +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-oln040092069062.outbound.protection.outlook.com [40.92.69.62]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 537F868B9B2 for ; Thu, 15 Sep 2022 22:23:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y2I5NgmTh4O2pLheToM5u3YJsna48HwvjvL0gQTww6CZ6FCjEpntVwCznJQ30t2ZXiAi0WHZ7XllL8sBLR7FDiCvYKvOwNFtEpvkyU5pRzXbQ/YQXqNQL3fp3WUJV042Nae1Ya0qSWfjp4fZsNY1V3XHBHdDK9nmXOD7LGzTZ+WFdack+3fpjXqnNqm6AQbZF7/g84Fd+keDh5RL1NfWPow+H07jjRjESeYlM2S681TDT/dfhyDlL6BKwHVW0zSV+nk4P2c2moEd31xNHu/BJyTBnehoD13/Vc7tPveHzCj4TZnVNg7aAdVsskLDXrxE2f0n6Ask/G0pcdKiGHUV5g== 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=GswkTW3gtGY5o5Sg4YNUFSRDOFCVarb+MOYn8ssDVqI=; b=MTUxorI+xAzOyZfN7r3gshBU6dd8wDkU6TlqVM6Iq7RGd4IsE7MSKrrT13Rirniia/u10Ebtm29CHdiGtsG1VZ8e2+hOtJvZRcv2Q6vqLl6vo51Ez5mp6jUrnjnVYBfAC/pmxDzf0JM5n2+g+XACuDWEORRPhJeLWMpTKd5sK0eAlT9l202R74Iwt0VneT1G7hzMVGH6jolRiIu9xqytUlE/EZ/8vkDP54+/Jptf4G4QDiR3+UTWzlSoPtCgTc8D35zBJyam4HyqXksm/vCSoW8E1SD73oFWBp9LyDx7c7m/aSlSE604q1obMZOkcJntVDrCtEgANzuy71SozVNUXw== 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=GswkTW3gtGY5o5Sg4YNUFSRDOFCVarb+MOYn8ssDVqI=; b=MIe9I8RwktuAiRleZJHH1WVjFg5AS8HYaIqZxBYFnzTis0qOfHvKPoduR8LjllfCDzpe97eDMrUH548F4+mVV97P8sh+dziAt5kpWFRZ7fjv44q0aqzh3JsDIsJ/1s4Pmsm4w7kR8yQ+83bXrpuV6aFKUMTjtGsRBBzQGXhELMCF598cR/8AJrdAD1djzuYC6Qc1norD4yapJBB/mn6vPQlt/Qy3IxfX9cU4X3ibGY4FdWVaJGtVnPP2tHbwDorjSGMk+/agdl7PmJB314CbSZKfB0oZmvv/QpjOV9iyjkFavVyXhkPWS/8LO3DxPreHituMmZLDs/hDhjsJZf2P8A== 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:23:21 +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:23:21 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:23:10 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [dWnGoT4LugUCwKEh7WORyf4awHzDlQCKTvvUaVh2ZXw=] X-ClientProxiedBy: ZR0P278CA0037.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220915192318.2761116-1-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: fc189cf7-0502-4229-ac9c-08da974fc03b X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nhHBm6ef2k4kg+632kkxCLikG7pkRLaJrjRrnq4mGVW50ZMuX6OUPyNlUP5vjPzCpz4jNw5lsEKo7GZjAqdNpPZHBJY9B6R2nltXNZqjHngc4FFXf3NGCSiQTf/WTbWNUHPjVeud9y7rqspaDWNRoJ9wsie6RQ+lQM6imsA66RFp1YAmMk7SxCOZ6GI+yzggLsv2faq3DFYowgZpcLEiKDSNMmn4lGyU07aVZagCZErD4O+/H5QlOuY/ldjABMMLxMfsGHuM/0ImPgWh+h+puC4CzBkVJMDavVFcZOViaRc9lWYYciD0yfH/gqMvh0pC+R48aJTGXtFzHZro/QjiBxsWCbkZMDjI5QImkFO+6x/azT75GKZnzPca/hZOPs9kw9Helcx32SnlZZJOpML2jw8C9y8+zt9hMTyGeF1/CxB7AwPtC5a7qzpkL809vBBCGVz4ahxJH2E9qZpLAQ6NT6GpMKHWcVkNDIhgFMCI1MyoRdosvwzRS6wM5/IR/XwgnwAzlUQ9Ty6runT8IkiODAwl9UM+G1ppZvlOdDMzQ1xxLVM86rI3/IBA1Ih3YEkS+Z7jmdTcRKhGIearK79qG2Ci25Wc+gBJyQQUHrn4HDyCcdyUVXxBBUhA1JgtyMI9A3lNPP392NqByTGTaE2gYD20U2ZdJ/zEUBDCVDiEUy6IvAVMDS/Mub0GQEJwpXZ7gC6n3IAkwMX0y+xldpT/QFF8B3LEv401gJc6DZuc8alO60iJRHFlAxlZzXirvFH0jGW7su21xiyo5pTtwtBFTU X-Microsoft-Antispam: BC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-4229-ac9c-08da974fc03b 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:23:21.1412 (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 1/9] fate/audio: Add tests for APTX (HD) 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: Yj0S328RnM1a We have de- and encoders for APTX and APTX HD, yet not FATE tests. This commit therefore adds a transcoding test to utilize them. Furthermore, during creating these tests it turned out that the duration is set incorrectly for APTX HD. This will be fixed in a future commit. (Thanks to Andriy Gelman for finding an issue in an earlier version that used a 192kHz input sample which does not work reliably accross platforms.) Signed-off-by: Andreas Rheinhardt --- tests/fate/audio.mak | 7 +++++++ tests/ref/fate/aptx | 18 ++++++++++++++++++ tests/ref/fate/aptx-hd | 15 +++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 tests/ref/fate/aptx create mode 100644 tests/ref/fate/aptx-hd diff --git a/tests/fate/audio.mak b/tests/fate/audio.mak index fd9905ca0a..9d39eeace3 100644 --- a/tests/fate/audio.mak +++ b/tests/fate/audio.mak @@ -1,3 +1,10 @@ +FATE_SAMPLES_AUDIO-$(call TRANSCODE, APTX, APTX, WAV_DEMUXER PCM_S16LE_DECODER ARESAMPLE_FILTER) += fate-aptx +fate-aptx: CMD = transcode wav $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav aptx "-af aresample -c aptx" "-af aresample -c:a pcm_s16le -t 0.25" "" "" "-f aptx -sample_rate 44100" + +FATE_SAMPLES_AUDIO-$(call TRANSCODE, APTX_HD, APTX_HD, WAV_DEMUXER PCM_S16LE_DECODER \ + ARESAMPLE_FILTER PCM_S32LE_ENCODER) += fate-aptx-hd +fate-aptx-hd: CMD = transcode wav $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav aptx_hd "-af aresample -c aptx_hd" "-af aresample -c:a pcm_s32le -t 0.25" "" "" "-f aptx_hd -sample_rate 44100" + FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_DCT) += fate-binkaudio-dct fate-binkaudio-dct: CMD = pcm -i $(TARGET_SAMPLES)/bink/binkaudio_dct.bik fate-binkaudio-dct: REF = $(SAMPLES)/bink/binkaudio_dct.pcm diff --git a/tests/ref/fate/aptx b/tests/ref/fate/aptx new file mode 100644 index 0000000000..4d20b7df9a --- /dev/null +++ b/tests/ref/fate/aptx @@ -0,0 +1,18 @@ +b5d8a297c0e8d9854f19d9d3e8b82859 *tests/data/fate/aptx.aptx +418950 tests/data/fate/aptx.aptx +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: pcm_s16le +#sample_rate 0: 44100 +#channel_layout_name 0: 2 channels +0, 0, 0, 1024, 4096, 0xcbb4ceff +0, 1024, 1024, 1024, 4096, 0xa66533e7 +0, 2048, 2048, 1024, 4096, 0x4f22ec39 +0, 3072, 3072, 1024, 4096, 0x45f117f9 +0, 4096, 4096, 1024, 4096, 0xad6c0b7a +0, 5120, 5120, 1024, 4096, 0x611618fd +0, 6144, 6144, 1024, 4096, 0x0ec02f2b +0, 7168, 7168, 1024, 4096, 0x2cf9ae5c +0, 8192, 8192, 1024, 4096, 0xfb008ac0 +0, 9216, 9216, 1024, 4096, 0x25068495 +0, 10240, 10240, 785, 3140, 0x5a260589 diff --git a/tests/ref/fate/aptx-hd b/tests/ref/fate/aptx-hd new file mode 100644 index 0000000000..0691f33c86 --- /dev/null +++ b/tests/ref/fate/aptx-hd @@ -0,0 +1,15 @@ +48ecaa81ee5adaaa62ed3ff6574b6666 *tests/data/fate/aptx-hd.aptx_hd +628425 tests/data/fate/aptx-hd.aptx_hd +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: pcm_s32le +#sample_rate 0: 44100 +#channel_layout_name 0: 2 channels +0, 0, 0, 1024, 8192, 0xa99888c6 +0, 1536, 1536, 1024, 8192, 0xc3e03a3c +0, 3072, 3072, 1024, 8192, 0x3f06e090 +0, 4608, 4608, 1024, 8192, 0x92fb18f3 +0, 6144, 6144, 1024, 8192, 0x3d5603a2 +0, 7680, 7680, 1024, 8192, 0xcc3d3101 +0, 9216, 9216, 1024, 8192, 0xbcc022ef +0, 10752, 10752, 273, 2184, 0x9873af57 From patchwork Thu Sep 15 19:28:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37937 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp520921pzh; Thu, 15 Sep 2022 12:28:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xebcC1Pk/EiG5zJWC2abn9Q4e6sLIDL3hMbqBoqNb1lpBcHwbpvXd1fsXquW5CuZrZxYX X-Received: by 2002:a17:907:2722:b0:77f:c136:62eb with SMTP id d2-20020a170907272200b0077fc13662ebmr983151ejl.522.1663270107263; Thu, 15 Sep 2022 12:28:27 -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 gn26-20020a1709070d1a00b0077eb65c41e5si9788294ejc.22.2022.09.15.12.28.23; Thu, 15 Sep 2022 12:28:27 -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=ObOejvWZ; 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 260A568BAFE; Thu, 15 Sep 2022 22:28:21 +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-oln040092069082.outbound.protection.outlook.com [40.92.69.82]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 53E0B68BAB4 for ; Thu, 15 Sep 2022 22:28:14 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7Hyhy2lX2sTr5YLZBT5btC33hPyb301c9Kgm105KrrOEkaGDyjWZHu3A5KmPPW9uhJB9CWk0gF59gAraES6Jeimj1/6F1tZNAIhZKFDLvo3pduKw1GcrkOSD7/FdggxArg1VzXOWXaEQZ1jrVRnbPB/rlBkpHDCDuJjYuqktg/K+EXBPql+++Rpb6qXBtjiM4PKlyg5kEFVQdzdb+kfM8zGCQkmoTjEHM0md8ulHqB4f0morwHhYWQBEEEmTiRT6I3UrWaKXrg3cp432n4bkaqbQRSPqIFPr3M9u5GzarAWl5jquUVuobNxk9LGjHRSQpVXdXOlepXeySP6vmw/rg== 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=E7y1xohbK4M9k9TIqxJvCjSZ+ee/P0POb5wy5A1kPdQ=; b=Jd3xzR6daplv3b7ywEuF0yIeik9ac33C3UzZ2S/aDYF8lafAfjV4rsIoyfrSHjvC61Ik1EkdDNsOywLZJXfsXhF3RjxNdItFXfbJKuWW+ldaLUVcSGeKs8C1Zeo5EvJBlpL2azN/7ybhtjVvNl6qQbD4ral6jK723tXW5lXwau1UPFiKSMm72+NZCWAXhEzFzf1vP2C5D+MFHKFKi3IAMFU55usPmfWDDDXoukjP83VC16dEp7nUU095xwPJ9YAAYH1MAFmexsgQX7PI9MJdW9v+LzLLsHzmuOBq+bvKYsu3OTppMxoIB43YLt70+RyEp40R7uegtKHSe+zn2lSIdQ== 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=E7y1xohbK4M9k9TIqxJvCjSZ+ee/P0POb5wy5A1kPdQ=; b=ObOejvWZnBphSNkgVMgkI0uq1dHBVXt37sGqxGRX4FzBht/6wlvsQrCOV/ZCcrwjncB0p5MxVe/idl/zOTS5iBOxKobOtOVktWwdfuIQXrGFu5XYvluWJIDX92rV9COvZh9JnhhSdnJxd+LiCteIoLltUr0pwutO0uq9NS6lM2z5ctJYvWmAdN4ghv9G1RnxBKDwKJ+E+yHyYXGrrgANqb/2E3y6E0DNHaw3IGo9DE4zMxx11Q+vqTkesLoMXMRMnCEpyiTosvXDftqPDw3VR3Nh6HiwGZqGd2ASpSYNFWmClKI0V5buzQ0qr/mOY5BzV3y+6ANcbvHN5/ORyVoc2w== 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:12 +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:12 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:02 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [qtLYG40rGHF21SFJ61HjChU0TnQ7tJOqqMpW+Xbih9o=] 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-1-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: 700ded73-6522-4433-419d-08da97506e09 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nhHBm6ef2k4kg+632kkxCL+DU1lznscpSZCOTYE5hATS7GRzYfa4pNQvS8Dr3cay9UsShEzhN9cXb4bSDNAtKCYRcFAF7kjau44UaSWhMxdH+ZXCD1ZilHILeVEfaHuq4rLIlTln+VCp+CJL8nF3GC8heoCJ8kU5XXb8Ni7+z+GeoVVV6thXb0a9LIlxFbd6SOWUuo00DsIzR+Gk2zw+xzqpA/9PpcB1GI+R+wX6BF5kH+d9DnSRtGxKCIrDVDKKRp6gsE6B3kmFTcPRpD4uGl5YyMJ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1P7ugSfqXhmH8n7eZGBT6s5NoyRkhX5aeXwnVJqR17NSEziDSsbKBn3NoquGVgtm2qQGdj40Cy0g9TliJStInUg9RktKIEujYlxXDbDYSwTVKmd8FIbNfvPw+tgrN+4ob2rrF9ztVX8g2ZAZJT4JnUnV6ojXe/439IiNCyoxXQw2o0aM7cYa12kvBUMPAD6+Rro8Y9vL+8prZsI6Iw/OiAYtw2e+0t1aVnCCZb0kh5HFIHqfnjMag6NrlE5m2Um5DTyLCxGjAq8ijAE7L8VzhcuAOeDCvL4NYmz3ZKxR1cNBCzk/ZwC+E/QnVho7jaCHkXwsSoak8Qs98eRPsyLOPFbFCriWD7U0HJpXHxkpVJayPPQW9DRx8eX4ezJnvVnppLs3RUsmgRUmsJkycBY+dFhhtWqeoqN2LaCacUhl7792xeAE= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 700ded73-6522-4433-419d-08da97506e09 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:12.7655 (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 2/9] avcodec/utils: Support APTX (HD) in av_get_audio_frame_duration() 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: nRd1lqzU4te8 APTX decodes four bytes of input to four stereo samples; APTX HD does the same with six bytes of input. So it can be easily supported in av_get_audio_frame_duration(). This fixes invalid durations and (derived) timestamps of demuxed APTX HD packets and therefore fixed the timestamp in the aptx-hd FATE test. Signed-off-by: Andreas Rheinhardt --- libavcodec/utils.c | 4 ++++ tests/ref/fate/aptx-hd | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2f57418ff7..ba64aaf32d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -682,6 +682,10 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, return 256 * (frame_bytes / 64); if (id == AV_CODEC_ID_RA_144) return 160 * (frame_bytes / 20); + if (id == AV_CODEC_ID_APTX) + return 4 * (frame_bytes / 4); + if (id == AV_CODEC_ID_APTX_HD) + return 4 * (frame_bytes / 6); if (bps > 0) { /* calc from frame_bytes and bits_per_coded_sample */ diff --git a/tests/ref/fate/aptx-hd b/tests/ref/fate/aptx-hd index 0691f33c86..498b9131a6 100644 --- a/tests/ref/fate/aptx-hd +++ b/tests/ref/fate/aptx-hd @@ -6,10 +6,13 @@ #sample_rate 0: 44100 #channel_layout_name 0: 2 channels 0, 0, 0, 1024, 8192, 0xa99888c6 -0, 1536, 1536, 1024, 8192, 0xc3e03a3c -0, 3072, 3072, 1024, 8192, 0x3f06e090 -0, 4608, 4608, 1024, 8192, 0x92fb18f3 -0, 6144, 6144, 1024, 8192, 0x3d5603a2 -0, 7680, 7680, 1024, 8192, 0xcc3d3101 -0, 9216, 9216, 1024, 8192, 0xbcc022ef -0, 10752, 10752, 273, 2184, 0x9873af57 +0, 1024, 1024, 1024, 8192, 0xc3e03a3c +0, 2048, 2048, 1024, 8192, 0x3f06e090 +0, 3072, 3072, 1024, 8192, 0x92fb18f3 +0, 4096, 4096, 1024, 8192, 0x3d5603a2 +0, 5120, 5120, 1024, 8192, 0xcc3d3101 +0, 6144, 6144, 1024, 8192, 0xbcc022ef +0, 7168, 7168, 1024, 8192, 0x600cbb73 +0, 8192, 8192, 1024, 8192, 0xdc938cbb +0, 9216, 9216, 1024, 8192, 0x37d968bc +0, 10240, 10240, 785, 6280, 0x48243144 From patchwork Thu Sep 15 19:28:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37939 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp520955pzh; Thu, 15 Sep 2022 12:28:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5l7hNrvAiNIplwi5EaeeBbbM62nbWgvjDVU0ufbqmo8alzC8JT+6JsmDp9b32e2Ts/HXVt X-Received: by 2002:a17:907:1b03:b0:6ff:78d4:c140 with SMTP id mp3-20020a1709071b0300b006ff78d4c140mr994959ejc.554.1663270113020; Thu, 15 Sep 2022 12:28:33 -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 z18-20020a05640240d200b0045161c9a31fsi245085edb.69.2022.09.15.12.28.32; Thu, 15 Sep 2022 12:28:33 -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=Zrr5gpAA; 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 0D99B68BBB8; Thu, 15 Sep 2022 22:28:30 +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 08A0168BB00 for ; Thu, 15 Sep 2022 22:28:24 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ri7mvV+KxmQsniu8tzzlUNZ4POZLeeiYqNX6xMqvm8jTj8lD+Yl1HJ4ZZaVIM1JlcvGnG+r3QPV8wz/6e7KmbLkluZDKpYTKIiNddea3I554jqoWBKA2Js5FWwO6e/bRc3Um+CObewdlCMlzfce70Zskx/T6wVaNhyVJi7eZCbH+Qxsb2eacJYD1+Be83MW1a7vab7dxZGKz69STZouniRUbVvFCz7axbH4j9w4qiLU0apITrVmPN+wNVqDjJ0rt3qpaXf80voksuueEAKODD/YxydTvwmf9qFnJ9ViGTAUJ/hXSsE08stLKqK0u9WgWgbWypq/+lgtllg7jXhPVEw== 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=rfGlRc1wrcGPA6nyLglVXRy80cI60N8UT0KyHD2R5WU=; b=kmCuBnIEyJhcKSgCEjJEhaGqwRpfsOHWjpPMgHXfifnODd/hMvog9Rh1oklZ5erNMMAVuii9uC4EQBoYkO35Ix+MvKVYlOrKpcxIYKcRfqgux3SMt84nn9r8LhV9cWmcG9jkGnUTx72Cuk9TeDhZXxLNo1bCDBAIPJ48aO1HM6Jolc33zFhCFoWu+nrmtQyIRin6+vqYPENviXZ3fN9USwq6NNVg8q5oSwE9HBTkvJCbSPgNdByQc4Aj5ye8W2p4cDYoai+XIfM1p7hNlNxf/9Bctaah65KTiqZXvba1ubf/k7oCBfDqksl/UWw4Cku+cRt0xt5ALXUjc82KYhgKCQ== 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=rfGlRc1wrcGPA6nyLglVXRy80cI60N8UT0KyHD2R5WU=; b=Zrr5gpAAdIl95n4y6AJGujjhpg9LXT8pmPu2Kr18iKTa1XeX9Re8hIfAXf8cG1b4GruR4rR4SfKS5UeVrzNXAVrlUwVnLBTXbQZZLWhz+BR01zCuoubiJJfrtpfpjIBmJdeGVybx7gBmfX2Rdm3P0NUPCgD+8d8vHVt2plPXUc3JgHBjTCEQIlZfyiE9j64Vsvr6e22T4grYxVm1NAIrGeOwajqfqDNS+YWxm9i9T01b4Uxu7N9SvVAA8426MkUTIRZRfwDn01HP6U7sAakBU6mYLiGSmoGXKZs02vw3ZH4J4XXWpzKzz2IVpxf+kOwwbTJOM02XnsIXkRIH91GJ/Q== 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:22 +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:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:03 +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: [aUwQiXnCM2jPNqeqJtOPzZeooeagfAJ71Zja/oXIiyM=] 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-2-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: 9f5e9036-5e95-4ef5-583a-08da975073d9 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKwiAlKx4YLPXfs4dEXJm5ZiGgBydc9RiFRtUoEOqrt6d7qchH+A2G/0rkID7OLcPE7xFSP78dyz7lOJWbD+keCXvG67zhERhUTL+x4KUAjOUahlnHnWSkz5ToHcBe8cdilyPjYjTevPBzRAs8xTiY+VaP1sj3PYu14QJLwd5N4XqqViXRfvJypBSUmpIeAsZgPVB1VRvVcnDpUC3HdYw+pw/YM5jRxPQ5myxVV390XVlC2+HiPF6S7UtiO4OCewBlDDMU4J7VOwwYUBQDdV+JmL5//+KgI8a0l83hSsX7Qg/dyMY3JvGvxnoWbD8Kynz2dkxWk/aNDeU9i5hS4gYdokiVIw1Fn9Fgjp/FRzvGWmF7cNXy0C4WZnlHTPLmMAxZiIWjVHZ/dJ4FUeDGjlhB1eq0aqXoTdkONQyLDmiNeXpjHdCsCKdXIBuVGQxNdCXrelGDeE3wasIW9HjIax2fDMG2Rw0NTXpyTqbMAZrB9SnHF8vatDizdY/lIV82SMsVF4OoHgtkn0U8YvWfcDCwzRGvrj34jdp8qFepDYcMjjxKb+E+P6eIWuRF8x/ViUOWLtsuvrUDz4j7EV3Vs00LPktzoxzWQh8wZcg93Osstc3Sk7clruXd01bpWNBfcxcp7vgOH6R7ugIJRiCxUYkWx4FUtRcE2U2PIZv46muRuXyUwqkkuaJKJwzb0OwX/6B6xdchIfmXYoCxExKn3om9h31xoMdiX5wgk= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oh9vX6uJpoQs3oOk2dBsanMYhXPSb1Y6/BoX6FuQ3Dc1iDAxvadr0gKRuqqc9BbZtXY81XwW2mgPjW3bk0oSNPFvkVD9BebS07utI9MdipUDVhqpBIX2GbHhWBoeW3Ldq3C1FftQN55cj1bd4aEy90gM6Opz8Osp8MF/58qMbd9bWYejQk02TDrRuaQnn/45qFqsw8jc3cQIpmlT6RoXw1NmnXNLQhvjG6TbbpNiFaeTOdMwnkeN69gOMr2enJ8Fsp7jjAhPRV4yJRM22p3D1H75bFzDua8JnseJ8WysKL+dm9MKaoQcyyQrvQIP7gUW0sIOaPzz6ICG9a/V9YRcb5XQwJAlncJfAhDkZy6bpbFAhmtewJpYxHFg71hBIXWt/4dBYGNza4hj7qn7BHPG0KHkiA28VB25CmffeLCzVyi3vw0UpZ46lIUNc83UHYLc4o078YnXUaoDA1uXmr2fiRnfwIuu0E4pseBTW7ZpzCOcnNQTXA8Fd5YQWoqMv70hxZe3QA+AlA4R28yzFAAtDZqfeMtQTlAE3Q62E5fES8NNNUNOHGrUV+jOGjOClVUNueFpbUqIZylFCUlwDqfrIMORAWoVw1VeB3TfavE3pJnJYQXV4xuZEYcnVCvFF65LVf48rc3leTiFLjKthnoDdg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tpDJsCUVSL1EkFVmrQWn9v4+t/4b/zFIxbijCeEjKpaUMiZ1hGrLBtcebjGfXNMHVoZyJV6RIMoKw28VwCitVDfMBCURIexNR+ibfEUj8LwGg4B3YP7bhee2NrhtDh/E4/ldKxnd+MDO4ny6/vGj0DnZg5b4QkYVl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W1sLPh30U4Vw3hvKCnd7w2iUgyqdCftzO/tEb6X3srnH16USbFLxno8mTVJAEpE4KEHlI1eD/E= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f5e9036-5e95-4ef5-583a-08da975073d9 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:22.5346 (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 3/9] avcodec/aptx: Use AVCodecContext.frame_size according to the API 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: /pttJ1sU7YW1 Currently the APTX (HD) codecs set frame_size if unset and check whether it is divisible by block_size (corresponding to block_align as used by other codecs). But this is based upon a misunderstanding of the API: frame_size is not in bytes, but in samples. Said value is also not intended to be set by the user at all, but set by encoders and (possibly) decoders if the number of channels in a frame is constant. The latter condition is not fulfilled here, so only set it for encoders. Given that the encoder can handle any number of samples as long as it is divisible by four and given that it worked to set a custom frame size before, the encoders accept any multiple of four; otherwise the value is set to the value that it already had for APTX: 1024 samples (per channel). Signed-off-by: Andreas Rheinhardt --- libavcodec/aptx.c | 9 --------- libavcodec/aptxenc.c | 3 +++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c index 8e110acc97..ed814ad1c0 100644 --- a/libavcodec/aptx.c +++ b/libavcodec/aptx.c @@ -516,15 +516,6 @@ av_cold int ff_aptx_init(AVCodecContext *avctx) s->hd = avctx->codec->id == AV_CODEC_ID_APTX_HD; s->block_size = s->hd ? 6 : 4; - if (avctx->frame_size == 0) - avctx->frame_size = 256 * s->block_size; - - if (avctx->frame_size % s->block_size) { - av_log(avctx, AV_LOG_ERROR, - "Frame size must be a multiple of %d samples\n", s->block_size); - return AVERROR(EINVAL); - } - for (chan = 0; chan < NB_CHANNELS; chan++) { Channel *channel = &s->channels[chan]; for (subband = 0; subband < NB_SUBBANDS; subband++) { diff --git a/libavcodec/aptxenc.c b/libavcodec/aptxenc.c index f9347853d2..434a9abf0f 100644 --- a/libavcodec/aptxenc.c +++ b/libavcodec/aptxenc.c @@ -257,6 +257,9 @@ static av_cold int aptx_encode_init(AVCodecContext *avctx) ff_af_queue_init(avctx, &s->afq); + if (!avctx->frame_size || avctx->frame_size % 4) + avctx->frame_size = 1024; + return ff_aptx_init(avctx); } From patchwork Thu Sep 15 19:28:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37940 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521029pzh; Thu, 15 Sep 2022 12:28:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7feI6XKKr5YdpSXLkWWzyjpIQrTClJMjSG4kUxcxkwauC3klud7PYln7N4hw6SxpQBdkuR X-Received: by 2002:a05:6402:b29:b0:44e:d429:749d with SMTP id bo9-20020a0564020b2900b0044ed429749dmr1141370edb.423.1663270120855; Thu, 15 Sep 2022 12:28:40 -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 l20-20020aa7c3d4000000b0044f2fb68fe6si130917edr.495.2022.09.15.12.28.40; Thu, 15 Sep 2022 12:28:40 -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=gNlqRGlT; 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 0D15D68BB95; Thu, 15 Sep 2022 22:28:35 +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 29CBC68BB95 for ; Thu, 15 Sep 2022 22:28:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NiBKs++mJXp7ZdFVBbt9bPI2jKPR7t/ti3smpkQT5ZsEYJHRyUfzFJy2LXl5ZXjifejZiGhwAWaJo28/no80v6XNi4Lo3LHfWpKVCm+KCXP80WX4tZ0uL56/dDXA+w161hpnoZGOOZkpx4Pk4CNVQDMOOoaoTdDig6n/ATHH0mSL5kDyw3Um7j8ZyirFZGKsK1RExscADNc0wbe253n22xcmZiDUId0sFVzOQQFSi+vASlN8zqOyBjCeR1g2ZLSI6bhFAYBL0WliOwklJhUXiNsCYdJD+wDFCZXozXBxHPlllGPfTUhkWtDeWVefkxESSCLiIegNtrEU/qHnsLU71A== 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=Ma0kAsJL1OY5fAduVkTxjwZXp0hHTJJfAzf+7pdP0i0=; b=dr2XELFY0HOl1RuKUbU/LcVgX7/p84R7YHL2Zbyy1doRNkxck1kcwyMkVm02+Nj+qFW6bHt1OvhFGc3WVUXlBldL4b69D3xvJy3a/K9zZ5Z0r306FuBllVV7b2cUdVb4WMWmd0w0zQER/ITiYLgkpMLUyJP85r+Z432l2kpdHQ5tk1WF2NkQ1aKAB21N/x9mTofeVIhc3sqoIq6ZNwQZpfmVTcO+DYej2lPIh/TC30n+JkkZg1qcuQ3DHpEp6kgiri281hYMh/6VAAJ/ffS4piknmBM3cPPMZcdEeATif6bE8+1IOvHTwNMSxgTznMPPKv81YgZNoMur4Kj57VsdJw== 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=Ma0kAsJL1OY5fAduVkTxjwZXp0hHTJJfAzf+7pdP0i0=; b=gNlqRGlTj2yFbhIu7hQWbRYWF2NuQe/5pSPk8ZlfUv5PRnIi0K14yN4qoglTxL5md6ql71cRuR0JBNH9/TyumBGXrvjIxAbybIclv9BlSUqGNsyqDFF34S0VeAddJckifTMOo9aG6W2TecwC1nCuDohyRERQOYIk11f0Twv6u5EczfEQ9DN7ujNMMaWoqCrHIftmvC3nBuDIWX0vXZF3ExOlUwlsYoTC23RMFhlvrwXKdI+OO8jbsN3g8OZh/5krVRnUena05KQNaayI3b2GowFV5r52IdZukbQF5IPkiivTEXYopvDHuz6LU1yOftzzRgELzj+UGYoNBZdHgYsa+g== 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:25 +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:25 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:04 +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: [989KFpmbKPVswNd7aQJ9ZWzCje+rAZgzGSPgiM1kUfo=] 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-3-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: 4d656451-be49-47f4-ada8-08da97507581 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nhHBm6ef2k4kg+632kkxCLcbAgZiSd6diK9zA/afVUEd2urWaYxaAjmn76PuYgoyGLAbH1mUZE5V7yD9gzXw4qLOybEd/PiZuQdvHO0c309xsj7ykRq85BbiwZL2AmUSW4nn13h4eUQmhNxW4VYuje0/P0Itx0HpEo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fxq7MtQeyHoQgBlAWue334G20IOIGiYJ0Ru090QpiGwFueWO3pApFabj47q/GG/79KvZkHkjyHs0CTf7mzoCrn8xCCaqxrjb/zqkVLiSgcRPsf1MaryQa+Fi8P7nn19FzcWZczQGx10FosUtLf5BvQOxrJxFbgMyMwloilMEZYEnrvblj1/IIqc4OMTygQfjg3bUBYAeRwddbcrUO9hrvlq4ivzByrD19mBfyOb6/77NfElS/swVE1Qm26R6xE1GpHQXsF/VGAaSxUC0z0hdQo7l/b/62ymHZ2VqDTXoViSl5IVwZS8mKNoXB6orhSU+mFJxwIKFIp5FC6UrbeSR2bwf0bBHjmAiryrPTslF4oN415/4U1J8RPn6aDEBmQhOW1lraiU3xuJ0RC6exsot5sm+m89BWtMMBDKDERqlplUVQxA7oOQZx+ngwN50iiteAe3OIUSNT0vwbdsrQ6JcRYehRKTAhDGrNmVMP80qMhXOGp6uhTSdru1LFKbZmm/HSGGvlN+/wf9rCVl+C2sAzbGSmF4vR01Fn4IcgP7yKyVeN1t07Xjz6aIv0= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d656451-be49-47f4-ada8-08da97507581 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:25.3456 (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 4/9] avformat/aptxdec: Don't set AVCodecParameters.frame_size 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: wsZV1xz/FxaE This field was misunderstood: It gives the number of samples in a packet, not the number of bytes. Its usage was wrong for APTX HD. Signed-off-by: Andreas Rheinhardt --- libavformat/aptxdec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c index 693316eeb0..aa86bfe330 100644 --- a/libavformat/aptxdec.c +++ b/libavformat/aptxdec.c @@ -58,7 +58,6 @@ static int aptx_read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_APTX; st->codecpar->bits_per_coded_sample = 4; st->codecpar->block_align = APTX_BLOCK_SIZE; - st->codecpar->frame_size = APTX_PACKET_SIZE; return 0; } @@ -70,7 +69,6 @@ static int aptx_hd_read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_APTX_HD; st->codecpar->bits_per_coded_sample = 6; st->codecpar->block_align = APTX_HD_BLOCK_SIZE; - st->codecpar->frame_size = APTX_HD_PACKET_SIZE; return 0; } 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/GS6wtjh2V8hhU4ybkFFD5IJhnk2J5vbkhIV3zEXSdon8V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kox6TLX4b3G3uKZl7uj5Oazomy2AOKAcL+shNxRoH/g/O2DDOmhIf8OUxNfXS57rH2tXo0OK/+5ZnAtug9508mvtv5hQit4ad6xtmOyvGVoo5zjtyRrfwLcvQrtDwuo+3vk5vAjCbN3eQBo4pC89UKO9pIvqSItfYTdGOQIMLxSKf1LyFfMByodRia+Cdt6dcUIX98msZ66U/mnC5Pw6dmuTh8bPzBiutL0aVPxdMRDuQb/DDTOelN1ZEwsJttR+5MW49ORlyLEm6mS3Abux0vdeHXldncX3Va7JmgRuTwLUas+M6H7QjnbStwupr4kzvTL60Z0rsyruCGgWH3gDGjeUi7GFtpIyqBKDryATHXxt0yWExpuGYaHoP8WVlfSVi5b57fZNgPPuOYevPe/Lo5JJMYOOn13gcBMfRIpOPdVAnfwgHWBRp0Tp+ktsj8lWzRzp1sUMsDsugTfIL3U/3DBv7Z3eOsPK2Ux+3j+kT8xvdAA4BdPkaNoXGd/3VhA2jQskUhxxhosUqyuurTYozLWJE2uqVMR1+9UjjkKn3rj1ML7uzhrm+b/ZaTh3HOwOFSHtOHjHotE3xKRYsF6BoZAl3obNmoS2SkkSTMQ0o= X-OriginatorOrg: outlook.com 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[] = { From patchwork Thu Sep 15 19:28:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37942 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521169pzh; Thu, 15 Sep 2022 12:28:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RZ9HYPK76HjQKPI5DFp5rEUzJR8g5omaTlQuiOzuIQHL0ze1CN+g+r45TWPSuhJBP4L8t X-Received: by 2002:a17:907:1dd9:b0:77a:341b:88cb with SMTP id og25-20020a1709071dd900b0077a341b88cbmr994716ejc.753.1663270137747; Thu, 15 Sep 2022 12:28:57 -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 hr7-20020a1709073f8700b0077c951af30dsi13270739ejc.235.2022.09.15.12.28.57; Thu, 15 Sep 2022 12:28:57 -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=NzburluX; 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 2435068BBDA; Thu, 15 Sep 2022 22:28:42 +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 7E54668BBCE for ; Thu, 15 Sep 2022 22:28:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ERM6xY8EKMilN2gATFluAmHrrQRT/em7IQng9jihXgZ3snSmhNAVPvEOAyacu59sxnp6BlhCmxOv29hOCiQfCjsNOx7c2e3v418HPhtrdvtWMDvFXlj7sOUkZeNDmbHoP0Xe4a4bN0NF+H9gDtU66LYOqpbm/x5IrA1irLpcJbrO3/tyija4FNU1uSvU5jDKgHfepF7ArvWj8F8MJwjUR8pTjgZZG/Kk3dzhBDJGJVqWA24P4XRQkK6jjLr5CAa4fuuPnnFQr8Keol/q8jP/YDfIanSoy9/qY/k9auT9SeOhx+zOcZ0W0IubkqaB1eHvhIOQkI/1069SewkY+ibwNg== 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=uW6h+Zc1S1dFZoLM3tQLB5MQEqfAwNAz6jxugpjaWYc=; b=JfD0Hm5E84ez69YVaN0No1JmB9Ri1N96AEuykVAnshnveubIw9OotTY2OjoGDiHyAbihY01ahXhe+mYwButHADLlDJl1XVsYjOiND4IbatdsdqoVo3Gev0Q1I1rwjMAJ97em30W9pWtx5+XHIcwDWHTJkiFTKWUm+BrwCTmj/7OT1nJ8iTDsQ/bna8vAZnRiY1IutrbvgEVzzjV5rl60cWE8vTvCinGJBO1eNotq8Z9PZODDn5eR7Z0K8gsLh4u9MChUKd/FaUToY9rVXs9eJvzn35v2kcUHTpOnGBK4/ZUHkOiYkhBEz0qdAzn7Y59FsGtvLU3Hf0dyt0Vet26iwQ== 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=uW6h+Zc1S1dFZoLM3tQLB5MQEqfAwNAz6jxugpjaWYc=; b=NzburluXwMAZo0KQayKBmDUZAHPiCXN3ddMtW5sAhHAvZCnwX0AV0p5xScbyqBz3/5yLWkQ5UO54SpAKaUl7DCJxtvMb0tDoFleSY9IWbqfBiK6ARUrPWv9ciOxiVZqxcaRwwFlMh8Hw7953vweeSOu4nWf9ImnMQXFOy8q237w0cJc/m+qu2ccJQwYmUZaGu15/2suXkXPPnTHt/oJKewEuL41ufJO0/sKJNhtl/yLJ/PIsytUZYTzxCRzyyzasmJPpHFFSVB64hCF0rTU551ZtPD/6i3QDQzM09ftnlhLxeUNJmHuiQeqs1rpXF9PcT/gY4IB2vnT8kP0ZZTBCyg== 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:31 +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:31 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:06 +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: [qx9hRJqoyp9O+G8kAZqGnLCNACrY5MbDXOw4+33yHFs=] 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-5-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: 9591265c-45b8-42f0-573a-08da97507909 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKwiAlKx4YLPXfs4dEXJm5ZiKk1hfDeE+x8NuKxjWrqBoxp5gyYz3ALMCuFBfpZHgh9qKqqBPOulNwtxSkF5NakkjXfF0H5F98KO5BoUcJAHlpczS13m393V8hmyKdRDW9DkdgiYWwHXGedAjnMOzywCUY1aXbAWGFwvOXRon9u0bBKT4yN3TGvGc0ZlJRIItwmRpR9S2c61eZk+4muJGqFYPL8S+9Q8MZXtY6BlKmX9XXhIC1w8uRTgOcioc4/7CN7VKtkf0Q/OpNefSL/0jT8eGgzq9WtD3rhke4QjdohQvO4mFefXbAXBiC76DtdNNOkkrJ7w1fa8lMImHtDxBtRC79MnKxb+kZwS6WEbVTTZtHnkdqxj26rfNkqyBjpmrS88v+gB6Dr9Hi/1gM87wOyGIL4EKfcScLeSPtaJ6TalsH97KrHUQApZS4h7LfNgfKhfw2764FB+AyZAd7lxOSxDHJL/7Q1QGz91c0t1S0MjboScAwS3ojqEIoTaDd60uXfZbOGSeZRm3B/26GeG2n6mihBY5QdQFGHTTqp757XEFLnIosLT7fZg/aidhmlw9cerVyZ4ezCSHhHmD5D2VFtzknIEfp1xioEIyQUNMO33SkT7GipaMXrmP6jsjTSq0PLoGVpdGxvTVw/vn6vLKniH3rrQ9bHhflEZadDeMzl8tIRaqtyADmyVVHaEIHtxaZuE17u69usDGKh5wah6lbsleJI5jALL/8M= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oagByH/BOuhRZjLrIrYaxdSCMAjal6i3c7w09RAurIGZHspMSd6tP2wFQ2jafVTNp+RpfZnPzDj+W56wPl10xFYLF/tdgV3frf1XaIih4037ap55pYuNxzrtSUyAeQ7SRclBSztcGn3dGcyA7dszodb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ZaHGGRxPgd0xqzNbdMHFpJK+HlQ3bBOTuYJREiMkZId8AfzlJnsJMq2HeWiEIKQyCUNrbs1EehC9w1osuEd2P9f0Rn+0C+zxrRP0wmaeEbJPOsfncHUdzUg+CQkLD9Bo2/obJST+UJfrP1r6+rRj7m7lpx7Zi9mpZv3UCdnZdywJ7k4BvgC7DKvcfD/T22dfS8HJd0TYMs5WjPkOvJyM9iCRj59TnHCjSsIoMmG9fvBngg6QjcsNI/bsz/Nz8GFA9fuDJXLypj+faRoydBpDQgcWeh7hSqZaQlLtk8aTclYm0rqHW+oxChJnE4j57bIDGrBil674Vv9k75nm5lysLZG7oizYGVHiK7ip/8gou3smJJkL6k5Z1cVdHA7I8LroSZ1o4hNefgADqObz4lrCfzGPQw67kibO89btYncBk8PG8iUEyq2vZ3251J+Dj9tJKdtaA/WeEV7PIjEwJLumXz1hnH+v4Uyv3DBsF0rYQymAIEEteCyv8P2KKYmcxjU4lbku13okT6YG7QQEr5n4cClNeHCJpRNtqu7uTTNLCEgx7nl+RYxspDY+6zxYiIcaySjKGJ40JcNbBEYLwFNIVdeFpNoGZH8bkMxcp2JsTtZrgukpo6h/3coIqV4+Xspg0UtN4ZiNJhg8cm7ArGcrIB7wevrLYqOnO9n+R5od1Rpk3VQNo9x15RxxU42CbILT2t5LDLFSUtc2Jw8fCU/OuGb3WyLW9Zc0oREkfZaLAmkuobhQaQ6CLBexbof6FEVNULmxDiSycA7e8Zn4qnY14lh5iqbklzSIu/3hv+bHeHx/TEYy7pbDWasXv0PFxa8RGU= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9591265c-45b8-42f0-573a-08da97507909 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:31.2210 (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 6/9] avcodec/aptxdec: Process data in complete blocks only 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: JSt7Q0+K3byf The APTX (HD) decoder decodes blocks of four (six) bytes to four output samples. It makes no sense to handle incomplete blocks: They would just lead to synchronization errors, in which case the complete frame is discarded. So only handle complete blocks. This also avoids reading from the packet's padding and writing into the frame's padding. Signed-off-by: Andreas Rheinhardt --- libavcodec/aptxdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aptxdec.c b/libavcodec/aptxdec.c index 878c9ffe1b..d254b3026b 100644 --- a/libavcodec/aptxdec.c +++ b/libavcodec/aptxdec.c @@ -151,7 +151,7 @@ static int aptx_decode_frame(AVCodecContext *avctx, AVFrame *frame, /* get output buffer */ frame->ch_layout.nb_channels = NB_CHANNELS; frame->format = AV_SAMPLE_FMT_S32P; - frame->nb_samples = 4 * avpkt->size / s->block_size; + frame->nb_samples = 4 * (avpkt->size / s->block_size); if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; From patchwork Thu Sep 15 19:28:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37943 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521229pzh; Thu, 15 Sep 2022 12:29:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ltbl83tcRaCa5mLyLYafb8zMXnMfKHHoSwKccV0tZPUZL/mZfhgtIT1+cV1l5SdnWdUA8 X-Received: by 2002:aa7:df87:0:b0:44e:2851:7e8d with SMTP id b7-20020aa7df87000000b0044e28517e8dmr1181599edy.106.1663270146454; Thu, 15 Sep 2022 12:29:06 -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 hg7-20020a1709072cc700b00780344980a7si4898453ejc.292.2022.09.15.12.29.06; Thu, 15 Sep 2022 12:29:06 -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=Y6XIFmxm; 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 329BD68BBE2; Thu, 15 Sep 2022 22:28:43 +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 9FA6168BBD1 for ; Thu, 15 Sep 2022 22:28:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HuBKGxcRAIslY9F33ygLOw2tr0cvTxyFmrtTErMIhJgoMrOqHtNvcYDe1DYxBv99qaQfWgSE6YpZz6hIjTFj+A9mayvsxnI9VTTRFZ5vYiNqQtkBAXWzsu3jD32Vaf+LAOdiYIf9NQCfSL1F6mHT9AQtKKuNPdKFClOjxuHG91agOz3u1+8d1PKdNxtQy2p94y5FnFsVxfvqEz/BVklxb6HZ+Z9QKsE6SDb8UCJq8DCi0DCTKuLxpOyNoM2oXC0RMdJ/ChUIqcC49LQVfpkHUgORWtgDy/KJ0s5Ktw10ZIoQNS60dwBRUFnfZhd0qWdRmD92ekh9UrkUls7ko9qiBw== 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=qdReKu6k28+UsPwN8HLOYbqv+9VsTeBV/BCYBogl5XE=; b=mnP0T8d565OO9EDtgl0Ce91xBIsZkL0DcPwZxEGFjGL8OstTW/2opOM95tgKGjmD01JHFp6X2rmJX7El63s205n//8Elwzv5dUj2KgFAr7+OcnOTzPCxHveNTq6+c7XKdBFQ9d35rYzc2pDW6oJWvFUK8CDFh69KE5le45VaBkQd2u3PUCMw/6AGQljy19C7n5ysA5N/uBm/K5rUpI4ifl6rdRh/aLnCcvNVyL1ddPfbDEKTw0WCqYnaFuAqoJARv838yU4Y/T8jeE6XKZqlrdk7QlHiPIKqW+SPlq0G4MR4T6uVYAJz9IZ1SNz4XyznN3dMtv59aY669al5+11yCg== 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=qdReKu6k28+UsPwN8HLOYbqv+9VsTeBV/BCYBogl5XE=; b=Y6XIFmxmNRnTwjcVTDpg4WIvpzrUaC+t730g77NllNSaFzkt0497hpXZ7QSQ/REFpVLOwfzW7fve3ZOJNor1wTHBAVhDaE1J9rjXfCNlDt8+GZcJ88MqZeteE6YM8MD44mptC8b2Catm03EyaczxBhYe68kkDVPUFSabDQGIhoIIjbC64zH+IBi1Ot9ALokbSR2muHfm5dTeTI96Ugd2QG8lMukJSDNeWMA0DpmdC23V4oUFXyryan8Zu0oiCGqXy7bj7XPk+tX/R/Anhecb4nXTuDiD/Lj2NgZVwwHcSRA9Znvyc6b/B2qvuGvniCD5WTwahPohqkcsidORhqUX8g== 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:32 +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:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:07 +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: [yRWbFlCRFVJpHogPp5V0KhyCJ/jZNOwNd8b1P4ldJoU=] 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-6-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: e64f0e42-cef0-48ee-8535-08da97507a0d X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmpAR802nmGrLwq0M+pXiNjeEt98m2XYOCjBWcZhQBO5u4iSgacs25ELH3EBkUiAxBYuYZ12RJq4obGubmxBB8LrlUfORbmajwtgdzm2aRAB1aQ9LoAgbeKamrocwkfbYN403pcojvoWkAqPMJLzWt4k+AQVFWrWW0fA4krz4vtybzLXNhpkgMs0vDedvwrp9oyKpki8V8Rv170mpJH6rE8S9CtwasJjEle33T3stttgsxi3YNEbR6a491IQCk8ALpyL/4EKA5pG8SW76XrBIOqvnuQjKHgRG+BolMO/OiR/ZNPIOHkLlfAdtFPf5tOxCvulu50Ny+uxOrFpnhHc4Oo/i3VeWBzFPKt+KUvyytg0Qrliae5FR9FS8aR/Jr72ptDkhVctwlPsOKMX1OP0BVP9jdrzxorO9V8EiHkq4eGO63HzwFf6EqzccHNb2bXvhBjOCxGQX7J6cH2GpkvKXNZM+OvrnyXFHsZ0lTgqNpMq4BE0WlH/3KhyEXDYLT9lLJps7UEqWKTS+IBc874nLE48YUgvw/P65okV30YuEs8Fi3mPMX/GpVoy6cLfH/1tlpB5983v1QXVlbbSLQuj+t1pLznYpfG4wjWZSrptiTrIcbX7hyFFVnEfxIKEQEFnrBVaX9nwX777bNtrHpf9LWd1+Z5EAp3SxhvysEH36whyJn+WL3MXW1VvkcVmuvDUceCzHcU6ihy0HdZzqneBYLqdh0qz//bHQa0P5rIvWBqN+7bFb7LTNO1m57a5IrQVWXI= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TLUSsVoWyZmIKaR4axNZNmoL5IzL1N25BO9HMXJrBZ1Im1IY1Ma5FIlY6RDDfURJdac7JpAGy1GIsTgmcxnQ39yOJ7B2H9zFQNYwJA8RDjBeu8d96Mv9IeXRlixWg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+xlMmmgnjIH/pbeCIMc4nQgRYjeV9qB2IdFwCq4FnEzyuNIv/pJnBMIJtZ91eTvPGAd89wUj0BEOgPTcUZMI4oUoCK+zp17SThY+tIIkole6nYZenjJnD6qt5HEzbwuuHbHt244HDM5Q189U5KxZOXHu4WrtnmAazrbYaRIOrZHud+GuulM6/i9eUkbB3uYD7SvfImwmpBowdU7MHCj3TIKtsFnK8wmyUUOyMN7kTLCgSF9BrwMJTHj+5R6qFMbNuch40IW8npQp49ZDKhCGD0XSU3PDeAjIF6V7kZmakqUU2eK8rLF35CtYj0jgujkd+Gtw4BxZEbYfQMWOlykLMJqz+Zx2j1jS1eFKDtdZzFp+U+ds5XXwHBN3lIUxBRcjw3CQLAoELJQBdrGm7m/YI1tq2/DOdlsZGO52iP33Ji1/aPheUZWf4IZI6BnH4Jqc3ePVS8wtutG6FZnryZ8yXi1U+y3bTpR3+lbQqUtkrKX5AGTzG2IdgeYxDT7cARtDBAoGjkPC85OXyL6lfv1yI+fVr4oW1PIZ+ji8sUqq6k8yeTNAEBkyzDoPklfgAFuVcYmysXaw8aZHIH7eujMM5MTbl9gOLV+7MRV2NCP9R27zXP69SUn9AgDGt+11tNP+J93G2qR75pAz5yXaT0YmSWw06mp5ysBKaTFWQHFot4HwT2bjPs5kwTcFBArhod0VSYpBGduNpMTQsjEGpMkWQr0cejTjE4H75K9IXwojL6lEodW6VUXjmS2PiAKscoAF8u9EJanhF0QDX0iCHNQjlpH8aWt+kZ6iPlYNSOmc9aTygS4U40xtuVUh1N8PJmy5Ak= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e64f0e42-cef0-48ee-8535-08da97507a0d 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:32.8949 (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 7/9] avcodec/encode: Redo checks for small last audio frame 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: q+wxJzPFIZqg In particular, check that there is only one small last frame in case the encoder has the AV_CODEC_CAP_SMALL_LAST_FRAME set. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 21 +++++++++------------ libavcodec/internal.h | 4 ++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index ade4d458e7..9bd9f9bc08 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -157,6 +157,7 @@ static int pad_last_frame(AVCodecContext *s, AVFrame *frame, const AVFrame *src) fail: av_frame_unref(frame); + s->internal->last_audio_frame = 0; return ret; } @@ -392,28 +393,24 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src) avctx->audio_service_type = *(enum AVAudioServiceType*)sd->data; /* check for valid frame size */ - if (avctx->codec->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME) { - if (src->nb_samples > avctx->frame_size) { - av_log(avctx, AV_LOG_ERROR, "more samples than frame size\n"); - return AVERROR(EINVAL); - } - } else if (!(avctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) { + if (!(avctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) { /* if we already got an undersized frame, that must have been the last */ if (avctx->internal->last_audio_frame) { av_log(avctx, AV_LOG_ERROR, "frame_size (%d) was not respected for a non-last frame\n", avctx->frame_size); return AVERROR(EINVAL); } - + if (src->nb_samples > avctx->frame_size) { + av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) > frame_size (%d)\n", src->nb_samples, avctx->frame_size); + return AVERROR(EINVAL); + } if (src->nb_samples < avctx->frame_size) { + avctx->internal->last_audio_frame = 1; + if (!(avctx->codec->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME)) { ret = pad_last_frame(avctx, dst, src); if (ret < 0) return ret; - - avctx->internal->last_audio_frame = 1; goto finish; - } else if (src->nb_samples > avctx->frame_size) { - av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d)\n", src->nb_samples, avctx->frame_size); - return AVERROR(EINVAL); + } } } } diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 35e3dd303a..45aec38a60 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -57,8 +57,8 @@ typedef struct AVCodecInternal { int is_copy; /** - * An audio frame with less than required samples has been submitted and - * padded with silence. Reject all subsequent frames. + * An audio frame with less than required samples has been submitted (and + * potentially padded with silence). Reject all subsequent frames. */ int last_audio_frame; From patchwork Thu Sep 15 19:28:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37944 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521299pzh; Thu, 15 Sep 2022 12:29:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ux6A4Mse1m+/TH5upx3vOBboZ2EYXsnz4VPU1ecnf3weKLC/2KjtUCt0KQ6bAMiq9xcCB X-Received: by 2002:a17:907:3188:b0:741:4bf7:ec1a with SMTP id xe8-20020a170907318800b007414bf7ec1amr1031424ejb.448.1663270155785; Thu, 15 Sep 2022 12:29:15 -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 tz5-20020a170907c78500b00733e46f4543si12900698ejc.820.2022.09.15.12.29.15; Thu, 15 Sep 2022 12:29:15 -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="BbxKn/Jk"; 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 2154D68BBE6; Thu, 15 Sep 2022 22:28:44 +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 C0CE268BBCE for ; Thu, 15 Sep 2022 22:28:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auhJDxGtyxSLy9sDklmSYTF3JX1Vszk8v3Z7WiXR1R6aSF6+rFMmFSxkw5M+Pq5XhhEZqOPrn0Dpr3P+hff2sI22PMrHOKsaL1zs88zk7Ik9eNKl7/fU5n83Q+T96GL6gIQe4yjlO3qbdhPFj50EO7Cebpi3JASJFNNfeNyuW+lIJLP+vOFK2YRyDlVxfsNnPOVQViI8i25k696N9KmgQ7PKyW7zh6dFX788+IkeTEX1NMVURku27qgTMOSmL22I82WhRakLaqga1OnyRDjWCWRhnYOf7NMXLATeoxnDzT3QjJbTurmSGDEYEyWj5/tzByAcX8yK+JzN0+KZNEYwjg== 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=Of4FfwS/7BjhqrBk/8iwTqFOtQ7TAKjzg1gFQx1AWzQ=; b=cDGzrT2trt83LUxKZsE/YkI9ZKKcnsYsbdKNCMiHBlIApKthj7n0D1wWYkCb2Vrz7URKY1KN7OqzeGD4K8z4lx3rz7Ndxb9aCO2N8rkliYDOoMp+6r8VjGcyHVfFn2lDE84tjtaQc31GZm9uT1ZiD6DRttvR3ndU3N0dk2sc+qMorgnT8oo9aWO0+n7UYqQ6DXWeHpSUb0ztUb1Raw+D95jeq6HjrKTxTue3ISB1K2fpAUxF0B9jQq+uN6LZqgSO82FqIlMbInMtc7ue75712BEfuOY1DfgPHonSPtxbBKVNC4G/uUeXSztvv5jC4hzEL39AmXrEow2lDaQ04fC0fg== 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=Of4FfwS/7BjhqrBk/8iwTqFOtQ7TAKjzg1gFQx1AWzQ=; b=BbxKn/JkK7SJZY+NMtEOLcjx4ML9+pAwAetmuzj+j1V+bZLzqHt5ls7XbnJ2Klx+SjKVwioabsGdHwk1HlRd4voKuhspouj5Pethahhzkk8CjE6cysIpu934d1TLfK7X0PBLr6MLfQiDpyGaxK9USrq8biu/LA73aOJF+ihYwC55Pfq19XeTJZQdMpV7kDPhSKgJbfa9/CCbBZyXc6NhyPj7420ogx6PXrRPcim9OgEMjXyNXbApchEXQuxrqaXX2RydPQ3olgmzJDjasGMf1yYv24WCwGA7+ZkJtLNrtE1e6EBXqyLemLakJieJp8R+SRC2nFS759n9n2ctDnbfCw== 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:34 +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:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:08 +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: [LGckI718TqxeMfClZnc+1N1bSBUmr7IXYJY66fVWRm4=] 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-7-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: fc84d9b4-d03a-46c3-8c46-08da97507aba X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmpAR802nmGrLwq0M+pXiNje7CC63EKd736FU7hQU/OGpwa/RSqynow9jlmkv4gslZQArEz64EOfYMiqWjotZcn/7mbSGimr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Dm2j234ifPxa8IENiANx/zlJHCc9JbPYZWjVdAC8Vno1oOxMveqGNRxfblmohmxxRjlVlAs10DYSBs5KUq2CFZbmBgYCt1hG1PshJh7OfqUBV2ior5zRh9M7eEDUH8CwDCz+oZ4pHneyu+3gOwCrL/lqNB1C9ZQsf1hnyGtYgihILzL9y2ijjcUcpE+QmnnQCZYnRAQH9dIPbcAJCimBLRkAN8w10eTkb+MxG8XmPjFVrsGfYn/PYsvuRPnvu+kqamdxf4uVm0QESSppwJhUwbVtf5mddAPGV7OYLGle4yNLgUEawT+eZ9cew+zxXzSNDmtI5i2pJvsDB98Av9zwOMjfl5xsYRjhSRUWnAaf5sqn9Rtqjr8bK3uGGPiIKD71SS5Srg2B7t+ABR6lR1LPJJs8Y/WMQ+WoNR5y1/piTqQpR4VWezuJsgVb27Pv+iuKqoh8ZGoZTLUpkq/n5gnTbq8VQvub/LtOOpPKjvT2+zS0ZcaJ8l98xaaWElUs3j/876sOKjAU5F4ZW2BQX5CySts7ntBdMojvovQBmBP/h2D8wuw4UuFZKCHiL27OVqUSqeDLbdKjvs= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc84d9b4-d03a-46c3-8c46-08da97507aba 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:34.0289 (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 8/9] avcodec/encode: Enable encoders to control padding of last frame 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: xKRr9DkpMtSr Some audio codecs work with atomic units that decode to a fixed number of audio samples with this number being so small that it is common to put multiple of these atoms into one packet. In these cases it makes no sense to pad the last frame to the big frame_size, so allow encoders to set the number of samples that they want the last frame to be padded to instead. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 17 +++++++++++------ libavcodec/internal.h | 6 ++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 9bd9f9bc08..049b71c6f4 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -127,12 +127,12 @@ static int encode_make_refcounted(AVCodecContext *avctx, AVPacket *avpkt) /** * Pad last frame with silence. */ -static int pad_last_frame(AVCodecContext *s, AVFrame *frame, const AVFrame *src) +static int pad_last_frame(AVCodecContext *s, AVFrame *frame, const AVFrame *src, int out_samples) { int ret; frame->format = src->format; - frame->nb_samples = s->frame_size; + frame->nb_samples = out_samples; ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout); if (ret < 0) goto fail; @@ -406,10 +406,15 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src) if (src->nb_samples < avctx->frame_size) { avctx->internal->last_audio_frame = 1; if (!(avctx->codec->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME)) { - ret = pad_last_frame(avctx, dst, src); - if (ret < 0) - return ret; - goto finish; + int pad_samples = avci->pad_samples ? avci->pad_samples : avctx->frame_size; + int out_samples = (src->nb_samples + pad_samples - 1) / pad_samples * pad_samples; + + if (out_samples != src->nb_samples) { + ret = pad_last_frame(avctx, dst, src, out_samples); + if (ret < 0) + return ret; + goto finish; + } } } } diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 45aec38a60..76a6ea6bc6 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -62,6 +62,12 @@ typedef struct AVCodecInternal { */ int last_audio_frame; + /** + * Audio encoders can set this flag during init to indicate that they + * want the small last frame to be padded to a multiple of pad_samples. + */ + int pad_samples; + AVBufferRef *pool; void *thread_ctx; From patchwork Thu Sep 15 19:28:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37945 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521366pzh; Thu, 15 Sep 2022 12:29:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gI4GuiI/wQ9Nimi/YPKTEQRBbPhfLXPethtKR+84gqdTj9cA9YKM2UohdafyGx38AM7Wu X-Received: by 2002:aa7:d6d9:0:b0:44d:e1b7:d905 with SMTP id x25-20020aa7d6d9000000b0044de1b7d905mr1183589edr.32.1663270164310; Thu, 15 Sep 2022 12:29:24 -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 f12-20020a1709062c4c00b0076daf135b26si12662301ejh.791.2022.09.15.12.29.24; Thu, 15 Sep 2022 12:29:24 -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=L4bFsYzz; 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 1568168BBBB; Thu, 15 Sep 2022 22:28:45 +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 E237B68BBD1 for ; Thu, 15 Sep 2022 22:28:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zh7FSwofkqBksISvjCQR8lej1/ozFEMS4VGXsCdWTtaRA4hAAKHsy7Fd+69Agg//buwWVtDr+az/z0uFcHjlHeeapf7gRF22zO2cItK2bCaQMf/B6MjE8ahULXWCuR1TEXYoiFABJMx8NaMjCOJDeuEjrLcys8g52cpBePKLMA2bLcAMedLtRTGLLPY6D+aDwf+N+5VUt/QkLh+mwIgPR/5NYuuJIfBkYefzbttt/TSuZyOzbLt2WDPpqMbQOpGLPr7ilNWGxDo3edgp/y9G2hdNMdW6icuriAVFNJFHgFjURc3UKuk9hKiV/34TOfkYr0uzN7iiu0i6n9gATXTWVQ== 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=YxgoHSi4N2llWAaWiTnZlCk03yLex5JgcSTiU7i20+s=; b=moJYRIAjEQv5sukhplCFrVvYe6esdHqge5trwuXBbOhmalsxSsMKXxpLPnL6KktOCLjOkC7/ea73hITskaMlLPMzgTwD6viSL0szEAuJqUmlgw1u9p76HaZXuUGHTPG2NR9nBAhO0II4My9aF/2UaRwOguOLseYz/k64tuMRoCofyGzuS1zNTEOqKRYnSP1zUNtT5jsIGrfuJxKxrWioCuSjoDXdP/aZCOtfV2R1ToTaH1AdCOS4ymy+UjfUxibnY6BsEqzZpUiQDE7CgJdmgSQvU83KakHdXfi/n+Vf4D4RLwKYHPxx7SLMFD7Y9up5e/GnhfudbxFkgN6bncolpQ== 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=YxgoHSi4N2llWAaWiTnZlCk03yLex5JgcSTiU7i20+s=; b=L4bFsYzzrR54PsmXnUVzdenboDP8+1nALE//7kHhnaVVGMIqRTLvgS0JXpAhuS3vYAPFk72aWBws+Mcl6DeHzUKkKBEY1Q7uvtF/qJnkbmVWeVK6WtuS+5kbGf5vfcENKXm31tI/UfdFMBdR2E885AE/Ahg/Pg4NDGzFYCTOvwot2DABevakNrWqQ9+aYlgDHDtF18KCf4bH+FwTkXs9IDkU3wicfcBe6JrSl46UkJ5HcBuiksnRZP8Ff282GiABCx8ockJqU8vRvPW3GBbAX9gCf4+FJpXRqom2RsDaRrKWtsLSus/wORkGLdHSCY5356QH3gh194qCoiFE04KwFg== 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:35 +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:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:09 +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: [Cd0wuwTpQku3YEc7NEIwEdNxXne5FCL4mzq/dqo0tJs=] 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-8-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: 378623f7-0615-4104-54cd-08da97507b6d X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHXuRrZwjAG4DhtEfL4RdXaCzSFFQJ4YFpPbjk2dUDjwkpGSXBVkmPKTLP61JQH7agSbKnma1IUV49Ye1YQUf/FLT8aOSdpEPKRpC2mEjSMKfy8TbNJIk3Gz7j05gHkyVsMhVKA2b4JirNCOxZI+22SoKd7aq4j/KwS7QZ4ldm6UPVN3yn+N6XsenLAGA333iph6BdB8F16iH1LFlXWDi/L/SFd4CUhJvxn/F/ClzA5HopdTvxT45rqO0Akpuvpj+WM68e4PI/lZtnG7WdNQzychETz4uJ/r3mB5F3KvPisaokDiYLSVYJObie6w8Rs73R4Z/sFUmhFoD48cTzv5T7rQeRUSDpDn7/Ukxv9VPS0cJNx7AezhzyYbkB0gMFWmyXLv3odRdoQiYupfid+mF2hW9P9yOdm/iRJt8OcwNs2BT3+p1C36Ee3aJ3uvNIHw2GeYjCn28GAdbsXcYlhn1AKTQqC+4jgpTq3DX/9Bxiry38LnxFSQO7kScpap/5B0ws3toWToK/PWcNMNULZCrRN8q/H0TPOSiU5VodMomvZqRYb+HWH6Om66FDLHCmLq35fIiPVSyBCPvsw6SDT68TKUb8xjpcGwv+SFNmdNeZQG25k/FIv5HyFNu/nncq7JYpMPfuAQ8aIsNLAEy9shzbmF1KZXUMGFE3knXL5Rs2k8x6SPdEBtOtk7yAWzcCbQaHmoTqR5jr3fnw== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: povwMVUezGU+v4ZDRJLznMSLqCIqRYiiilwt14WJ+q6xOFi+koo9ukRpdU3r2zJxpK1SKclcVZ8WnuJDVINUa6cTElVPPvr76ny4hiT84/JGu/2UA1nBwTH30lWMJHBdc3ZVZom03mGrbR6ThqNCTcTrRFuawM6e542f6lvVhMTY02gESv/tnwFFpyiCA0DWju3zRhzt9ZRy0cjuvvdYJXTPzBygxA2gDs+JszNSwZhzIWU7+Mf4nckDwGhv6eJxlf9U53ku9dXJpR90CBFFypbf0zOcSLsXG+DqOnEvN8AQxmacRW92AbmVDh0Kchf/rbOt6ImkqmcXd6DVb14ppK4lyMGMPCagbcQb1MBtsLSb6Jhc5o80X/HTpWSm7STRrLWAXXxhnhduBH/28kSXZfoigLj9tS9b3HsUUnF3b/OZ6CwGPhIpPzYO8G21Mfp6N1GzVpQhbXu/zcVQN2th0ZhaZ3wCGvDPaYn01JtRFeoqykX5L9sPk1W8/I3kzIGe3zLEDUBlwy9PcnKyOfwmOeP+uCWOjGDVt4DVOA1mX65oa+lPlHMHE/dRMY0o0AgKXYvK150niWUDGYL5LKvdxsV4rH6s2LJzZOMtEoZ/9y+2AAOphLVO15qpz9BQdeDHIZxeGWCDvnCANB6HDSyIyA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 14CU+FVSLZu+uUPqhy0FZYkrHQT6zTSHccmTpPUQGeoxPknvDEs4xx5nvI+Fb3nhbie4SEpEl7EMTD6xVyZGga4KIg+EfJPZqIOWQhrZ00wmSBFCerMR07Z4Z0oOtsi25lZjjxPhgZ/yL+21VeaMFvTLjgNcssFQB2Zelos88dgQO9d/EVu2OKkKS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KdF3YHSqmTyXeVyV0pE3A6P5yg+Jp2fF/nHyrufOpDT073cNmjH2oSSLxw= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 378623f7-0615-4104-54cd-08da97507b6d 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:35.2005 (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 9/9] avcodec/aptxenc: Process data in complete blocks of four samples only 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: SblpFoN6NwmP Do this by setting AVCodecInternal.pad_samples. This prevents reading into the frame's padding and writing into the packet's padding. This actually happened in our FATE tests (where the number of samples is 2 mod 4), which therefore needed to be updated. Signed-off-by: Andreas Rheinhardt --- libavcodec/aptxenc.c | 6 ++++-- tests/ref/fate/aptx | 4 ++-- tests/ref/fate/aptx-hd | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/aptxenc.c b/libavcodec/aptxenc.c index 434a9abf0f..114e286fe2 100644 --- a/libavcodec/aptxenc.c +++ b/libavcodec/aptxenc.c @@ -27,6 +27,7 @@ #include "audio_frame_queue.h" #include "codec_internal.h" #include "encode.h" +#include "internal.h" typedef struct AptXEncContext { AptXContext common; @@ -259,6 +260,7 @@ static av_cold int aptx_encode_init(AVCodecContext *avctx) if (!avctx->frame_size || avctx->frame_size % 4) avctx->frame_size = 1024; + avctx->internal->pad_samples = 4; return ff_aptx_init(avctx); } @@ -269,7 +271,7 @@ const FFCodec ff_aptx_encoder = { CODEC_LONG_NAME("aptX (Audio Processing Technology for Bluetooth)"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_APTX, - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME, + .p.capabilities = AV_CODEC_CAP_DR1, .priv_data_size = sizeof(AptXEncContext), .init = aptx_encode_init, FF_CODEC_ENCODE_CB(aptx_encode_frame), @@ -290,7 +292,7 @@ const FFCodec ff_aptx_hd_encoder = { CODEC_LONG_NAME("aptX HD (Audio Processing Technology for Bluetooth)"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_APTX_HD, - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME, + .p.capabilities = AV_CODEC_CAP_DR1, .priv_data_size = sizeof(AptXEncContext), .init = aptx_encode_init, FF_CODEC_ENCODE_CB(aptx_encode_frame), diff --git a/tests/ref/fate/aptx b/tests/ref/fate/aptx index 4d20b7df9a..7917399297 100644 --- a/tests/ref/fate/aptx +++ b/tests/ref/fate/aptx @@ -1,5 +1,5 @@ -b5d8a297c0e8d9854f19d9d3e8b82859 *tests/data/fate/aptx.aptx -418950 tests/data/fate/aptx.aptx +97dfd7f32d34fb74337c0f6c66e26e2d *tests/data/fate/aptx.aptx +418952 tests/data/fate/aptx.aptx #tb 0: 1/44100 #media_type 0: audio #codec_id 0: pcm_s16le diff --git a/tests/ref/fate/aptx-hd b/tests/ref/fate/aptx-hd index 498b9131a6..d74c1059c2 100644 --- a/tests/ref/fate/aptx-hd +++ b/tests/ref/fate/aptx-hd @@ -1,5 +1,5 @@ -48ecaa81ee5adaaa62ed3ff6574b6666 *tests/data/fate/aptx-hd.aptx_hd -628425 tests/data/fate/aptx-hd.aptx_hd +6126e414af1acb193e24fdf33c7cac2e *tests/data/fate/aptx-hd.aptx_hd +628428 tests/data/fate/aptx-hd.aptx_hd #tb 0: 1/44100 #media_type 0: audio #codec_id 0: pcm_s32le