From patchwork Sun Apr 11 00:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26852 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6412B44A20C for ; Sun, 11 Apr 2021 03:39:55 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 30751687F20; Sun, 11 Apr 2021 03:39:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074091.outbound.protection.outlook.com [40.92.74.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA7A7680C54 for ; Sun, 11 Apr 2021 03:39:49 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzzXHwE5KogOG1w6yjFny37KUHxHX0uMNpRTta2KdiB17vygAoolP5W5KPnzuBnNlLHZM4eo8iV+5Naz9u60+skISyx73d+2fTwllHkH+EAzLCLIGSpfcW2nzjL+c6K/284rxwdwnky0K/AgyIOQmLM1WyqEcI0gjCF7850vaG3Q8B0UwP6+MPuqSe0tRB2PcbnieHCqn+cY6sogBxVJIOOalPrMl2wXvxuk2TH7+L44rx2RnsmFI2q/nSU2W6FOxIbadu7nmlV3Yxq/pwJDNGbz7qvsmfpdxgdDzmA6gbrpP4sH6ENlVpdNPlrHI+DiOPzkgdNSmkAVjFxgWR5Raw== 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-SenderADCheck; bh=Y9sH9DMZbEJVvleWu1Tcwnmd/2GnlNeo5bcCMqitusU=; b=X039SGYXZBS/nfRPuv6gYtI533o6cerFTQ9iTYbOegAZa1iCC4TrcfUtk6KGssCSbvdEXoJgUu4n6JGi0vhzytlwda32v2gE98ATzjgLp0K+jfjFHbjUUlONkJ8UD5HwjBu63cuASFt7TmHB9WVtFz2HONRDKrfwSJOOvF6Ri0cTuoGYLXf7Q+3mDKeRTWl6nJgSjr1reo3vt9UurAK0B6daolyqgsRNQ8vl+snG2yPz9vUUGuP9Rxq82dL3uJD/7Ehc/6I5O37wOjyVOmWia1YsTxEODUsUoPFAEv/IN0X3ETWbqEwzt2EtqRvSzs6O+BZmkj21Vwqia+J4pG+w0A== 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=Y9sH9DMZbEJVvleWu1Tcwnmd/2GnlNeo5bcCMqitusU=; b=l5ZBnn0NE5oYXicv4JFuL9h9yYUzLNYgXACids2+BINlOIMTU2Q6XqPW6xsShYF1pIM8+k4AppyXKWpKJDWa4kf55Dst41erFUl6idN+lpkMFVi6Z7kQg3AKSadfKShHoNWBb3dgrncbsuUx3jII+t6e5PBBK1DC4eyRshFY5woe04Js9io6RL+kxykH6csMqPFeVIODncQyye8rwD7gb/ACu3KoKwTw3S+jGZBck5MqsYRhVGOcrq4XzPtS0Pnksr7cmedfOepIFREPl/beOYQeh8brFJvPjPgMv4T+ezhqndxNFirWXzj0C4Ttpc+ahZUBnhL+bn8HOQM+N5ibNQ== Received: from HE1EUR04FT003.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::42) by HE1EUR04HT203.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::401) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Sun, 11 Apr 2021 00:39:47 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e0d::4f) by HE1EUR04FT003.mail.protection.outlook.com (2a01:111:e400:7e0d::273) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 00:39:47 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:22297BC30DD1D75B7BE4B3154DF07E477A042291CF015D76ECA410F1612704CA; UpperCasedChecksum:BEABBC930AECF3A02C3256C1B3B6BAA670CB757417FD8F3F880ED2C6E9274955; SizeAsReceived:7412; Count:46 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.4020.022; Sun, 11 Apr 2021 00:39:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 Apr 2021 02:39:30 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [ldafcpxdKrTmwvEzDpeGpLbmNALHBAw+] X-ClientProxiedBy: PR1PR01CA0020.eurprd01.prod.exchangelabs.com (2603:10a6:102::33) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210411003932.219580-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by PR1PR01CA0020.eurprd01.prod.exchangelabs.com (2603:10a6:102::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21 via Frontend Transport; Sun, 11 Apr 2021 00:39:40 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9994b678-18b7-40c4-c6fb-08d8fc824b2c X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiQcOwkohpkMj5HspU+N+noE7zBINCdnSfizc/i7sLxFYWX5PGgX5X328Lc9piLrlGPV8wXnjT8xr9ydYx/3KsYtMGC5POrnkDLW0rubnwLm1CHUcAMb5V69/cy2LZzUMMSJjpwNMBFYDa9102YCWGmqjICga5/9Ir7g8+Myo4j1Pfvqfn2chyMagGyXI1Sv/sXY1ocs14KuMhse6R+oQvCamjFihtB+YtFSkdTV24K+N1dFQYCVfC5zLt92oPqnMfJ36s718C2clWtiPmWJNSpDMD276J9csbMsebpDkcVyMIYxZQwfK8AHOkwQt580Wvnd8kPfaHs4oM8187CR63tZU4w8+fr5aS74belt1/4ywSitSl3y3dpfhMZPg8JOMnZcfTXi/yi87vM7mevLDWEGlS6HIT9LOB8D05KGNsihRL2aFylUpPa/ZOMzf8hhJQMLDlZ6iy6ZRbngo5atYBz4ZwRcvyMMyblpPLnxyN/mVjKRIj86kDCR4I013iROfCLW1jGf03CfYPK+pbOwsVc0/XNsKvPeQUMFwNiZUl8IYIpuHQwxPHRXmOerMTE2scDJ1/Poh/ll2w9gA4OaE8ohYb+o/3plHvtEFPPWKgANuH+yKrNn6exUsusGdDw5hzNkBvg9VpHzwjiN67bIppV2zpe0EWaPVpsYNxpzkTmyG4JxtsCK4Wpk8qtLsx30dOrfNai3wfoOOAztrT6iNzsZph8De05LvTprx2O+WdqXegtsLTHj9dDvoUNCkFVNIUk= X-MS-TrafficTypeDiagnostic: HE1EUR04HT203: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FA/KPIjw/dIdIjvUzZ50HCScKiD1es+6R5WSS3RiV6jr/9uIeBn+NSiokXbb5pA+yRSXQIPHFftWsW6C5u1iOsvBs+CoF89Zcblc1Y6zBI1oIqFM4guQduCGy2cLHQ7hc8gVvh4zSz1S323HPs/69IbnmO3/hrNTxdbNh6WX9TaW5egTlunmOAljc29eZQxpaL4HsqREH/cr4CKWOdxwkFxqA6mMfA7YlmT+5HBbd7F0+kipNXNLz6MrCWdj5aD1zcNzZk2bl9mSEhLUxv5KQqLtvFUyDuIaxW+yg3LZZYS0lJzgqPvEWrDIJX+QU1SDYqi/tO9ago2PJPgTe2l3OYRAQH0trXW4wkcb+/bfM4j8nKMqftmRy8XLFhAWXTeZzAi64VzUEZRqhj4jhqIetw== X-MS-Exchange-AntiSpam-MessageData: ASMj0nU0LvTNVuRDnCy5t/w9Un0C6D2+OjSi41cS57YeS81IMoJ8uz7SHP7Jn59riv21w1PnB1xi0kYgvV4wgY2ANikQeIFb/inLTRhV7eU3bjUX8FhCxcJplL6jyWCwqPCedLDMbJBm7+pZzG1mFA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9994b678-18b7-40c4-c6fb-08d8fc824b2c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 00:39:41.7055 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT003.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT203 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/libwebpenc_animencoder: Don't return pkt without data/side-data X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" They are essentially forbidden in our encoding API as they are considered empty. So just set the data, but leave the size at zero. (The old encoding API allowed such packets: It used buffer_pkt_valid to record whether the packet is empty or not. This has been changed in 827d6fe73d2f5472c1c2128eb14fab6a4db29032 which broke said encoder. Said regression has been reported in #9179 which this commit partially fixes.) Signed-off-by: Andreas Rheinhardt --- libavcodec/libwebpenc_animencoder.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/libwebpenc_animencoder.c b/libavcodec/libwebpenc_animencoder.c index 7f35a0b939..d871e85d43 100644 --- a/libavcodec/libwebpenc_animencoder.c +++ b/libavcodec/libwebpenc_animencoder.c @@ -34,6 +34,7 @@ typedef struct LibWebPAnimContext { WebPAnimEncoder *enc; // the main AnimEncoder object int64_t prev_frame_pts; // pts of the previously encoded frame. int done; // If true, we have assembled the bitstream already + uint8_t padding_buf[AV_INPUT_BUFFER_PADDING_SIZE]; } LibWebPAnimContext; static av_cold int libwebp_anim_encode_init(AVCodecContext *avctx) @@ -103,6 +104,8 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } pkt->pts = pkt->dts = frame->pts; + // Packets without data and side-data are not supported by the API + pkt->data = s->padding_buf; s->prev_frame_pts = frame->pts; // Save for next frame. ret = 0; *got_packet = 1; From patchwork Sun Apr 11 00:43:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26854 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 56B7D44A69C for ; Sun, 11 Apr 2021 03:43:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D470687F34; Sun, 11 Apr 2021 03:43:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-oln040092073105.outbound.protection.outlook.com [40.92.73.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DBBF468008B for ; Sun, 11 Apr 2021 03:43:11 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ifwHtSCJDLJevwzPgfqdp31C4gVM8xzubyPnNd/DxG7kJrl8qWFCAg6m5lKIIvd6OkO3+Yt2TyWTQUTWcQ+dFwRmzaEAhtu6wAMcVQnp4INm0mr2yYg81a56wVvyA2LRwGhaI+/hDfSnsWqqycB6czxtRPmUq6/TlZvyjHl/lN9yt37nX71jbtFkVQ4BijWOOEi6o5zMBPkY5HuDvNCWa3W8qY5DsoQaV0TapIkkm4cTqLvK33OeDwSm2TsmTb5RF/D3IaLbW6VFTYcmpjWcn2ogzsrqdYMQvNKKRgsuj24WB2P2j1VX4DuvxcfhgrQeCYkX/yJfZKib1wXCu/9YUw== 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-SenderADCheck; bh=3exoPzBVqDX2qWU/Tl+X+1du9qOG67dcgTYEju3Zki4=; b=DCib5u14RjhIYAKSEZe/N8iXZaerhLKPXxTIdWPpBluTLuObzM1S6OnTAoygJlO2afz8X9eW5Hfr0ZMJMaWo74+wkb8NC6rMvB2ogFlNNj9mvgn/LXwnxvzIAJ3utxcXo6V+IVJsyNf6ce0HacRbq5USz7RWsiPo7w79Sgy2hkErZSVd3YgYyPZ5vOs+cubPuLZIymma3/K/n2FSUdoFLY+CNILTAsKsLDHA8fNDCeTNp0yr7Gcpg7jVoALE/izHLhZJw3U2AumLQxFO5sW+uYSNJuEu++sIDZbEnyuDyxkLahvUz0BSvcTzgCYqj0iL8jSonFfz//xXD39PIq3gMA== 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=3exoPzBVqDX2qWU/Tl+X+1du9qOG67dcgTYEju3Zki4=; b=S0wfNc/KBKme6j/wqNaUU0FSoqFCW8QiUUnyDc2YP63hBAUeyhskpkiw89SU5OUcwGIyU5tjLXENboA3LrGZsxOTWKv1AIeDIFWU+MaMBeiyFSf8yy2hY610GC6NW8Au5IhWF2UYtybR8KCEHbOhgeqTKBrz+zSDaE2iRbcF07rtvCAgJdG3+nyEPY3zGNuB6LkoAi1F01IV6kjTjzz61B1/y+7J+0i8U9ShuA3IH2y3yUiMdiRmyU/uA3Hyar8VljzlH0uo8K/hdB/+swGikZCxSnU93gXGjhUkRo2k/vfR2FVCTuE4Dch5BauZPHWIqMkK+odme/MJpAmKT5Vr9Q== Received: from HE1EUR04FT003.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::41) by HE1EUR04HT082.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Sun, 11 Apr 2021 00:43:10 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e0d::4f) by HE1EUR04FT003.mail.protection.outlook.com (2a01:111:e400:7e0d::273) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 00:43:10 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:362C961CC869D00A935CA8C28B703CA3557C1EE631E62EF2C699153627616703; UpperCasedChecksum:19807653B23B82ED858A3B0C0E12CD1EC34458DFBF3A3AEFBE863CE1E50EB123; SizeAsReceived:7588; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.4020.022; Sun, 11 Apr 2021 00:43:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 Apr 2021 02:43:01 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [J8A3NNxn10lLkzZ+tNkUZFY1sP7crNLJ] X-ClientProxiedBy: PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210411004302.219786-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sun, 11 Apr 2021 00:43:10 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d5970934-52a1-4151-8a75-08d8fc82c7fd X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiQcOwkohpkMj5HspU+N+noEF/QoaxDLX1TL7iwI2o+YkhrpHSSyXc+l1f93nHPwlsvRMXUC2zvb80J9nNqz3KALHS/fGGuem5dH9oQ2hSVt+OIcshQux7vR0zRsb0uWF/c1ZJoGLuJGR7CVRbKLeZQwx2FqOQWzv2SvpqNWVexLCxYxx4dc1Lct7++sx/pegKyfmolr5CxH9Glyo4Tlzenbx/jWL7X1ywHaP+epfitbY3ks1EUsd8i8HU7exWezGjHOR/ETuugLuBymQIQiLa6BSkkYQ04UK7ZsIDcVeukwsdmy/3CU9lsh22Xjao3ckbGoiJJeqUqtNmQnJSNKMCHpSUNvY0usGzGd2SIFXgdVTEyD0GxjPFLIlFsPThd4OAFFpvXgVbndlolh9NTY4LobK/6pzANamFK204D16mVcItGz6t/S9BB2dyxtUypXikz3Cogvsza4uDswL4DFtzhXeBaU6yyAT/o1zto+VxE48qomLUEPd7ZGmWXOTbrEb5q5GSflUNrPO2IX7YV3x80FzJwxYUvtxC3RkyDbALrr270xALraot3OsFe1p0Smi+tRqHoLC1S1k7vpcuSPmk/W7HAVgngfi5uMX8mbneZqW3tRXdO+lZUwR/rcdJByNMVk/8YM53Fh/NPMR2bjWGCZaav8966MTWw7q28lk5oelvIlQGVoglabGqnJxB+R5hjF79/CDjOjiqTKQp6k+WvdV9MhSEmJGIRlQzd1gCpRRUp3/vad2r7T89uj7a49ChQ= X-MS-TrafficTypeDiagnostic: HE1EUR04HT082: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gAFvaknhUEuUu/t5GQ2KAJfls20fpTrkVx/HCzdFXTZ8y1hMtvw4B5qpRffr/1uYJA+6hSa+3wD3Ze6raP0UtqGODDlEITCfvHJuWspmm8Q9BE4xYNScA9pwqhpqT7oL/7+tPfXkye4nWlQoyTtwCQHCPlt8wTIjCSuBVfqK7oaDSLFuX1elqXHB9iAyBoC6jOyOmONkvRFjC3Y5EGilSFEBQmKEoo97rIi5nfv2rrM20UXpjWRVmJ7aOWCKmIjpQPOC/uNlzWTddmrxxYMVSpB11Y0yTQj4vimzJ+iI3MaioKxni20LMcu38o/8Tlj4vwToGgpzLHnjFa5ezC1NN68l0xDNqP3vEFVDFtUdFg7csB2mcoeIEckKclo5IWfxHtRvh5En052cLkQi4aK+CQ== X-MS-Exchange-AntiSpam-MessageData: h6QJPYcRyqp6OVhR8V640oVjpFhpc9FIJsoGtLIE96TG0knMlxeUuypxvUZy2CDWBNq9KABDiqnzve7BoAaoccnIxqRjZaAAXULvk+uy9HpDUL/pDPjwqX/LI5aOdqE4OfifLpB6oGuyzXkT75D2bA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5970934-52a1-4151-8a75-08d8fc82c7fd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 00:43:10.5734 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT003.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT082 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/webpenc: Don't treat zero-sized packets as invalid X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Before f9043de99a23e35a34c79bfbc9ef17b27f7236d1, sending zero-sized packets to the WebP muxer led to memleaks (unless the muxer was already in animation mode). Therefore said commit simply returned immediately if such a packet were sent to the muxer. But now it turns out that such packets are not that irregular; in particular, one needs to account for them in the frame count. This patch achieves this by treating such packets the same way that they were treated before f9043de99a23e35a34c79bfbc9ef17b27f7236d1 with the only difference that they are not cached (and can therefore not leak). Fixes ticket #9179. Signed-off-by: Andreas Rheinhardt --- There is btw a big leak left in the encoder; I wonder whether we are properly closing the library. libavformat/webpenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c index ed8325c02d..3962986c32 100644 --- a/libavformat/webpenc.c +++ b/libavformat/webpenc.c @@ -56,6 +56,8 @@ static int is_animated_webp_packet(AVPacket *pkt) int skip = 0; unsigned flags = 0; + if (!pkt->size) + return 0; if (pkt->size < 4) return AVERROR_INVALIDDATA; if (AV_RL32(pkt->data) == AV_RL32("RIFF")) @@ -145,8 +147,6 @@ static int webp_write_packet(AVFormatContext *s, AVPacket *pkt) WebpContext *w = s->priv_data; int ret; - if (!pkt->size) - return 0; ret = is_animated_webp_packet(pkt); if (ret < 0) return ret; @@ -159,7 +159,8 @@ static int webp_write_packet(AVFormatContext *s, AVPacket *pkt) int ret; if ((ret = flush(s, 0, pkt->pts)) < 0) return ret; - av_packet_ref(&w->last_pkt, pkt); + if (pkt->size > 0) + av_packet_ref(&w->last_pkt, pkt); } ++w->frame_count; From patchwork Sun Apr 11 00:43:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26855 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8B6E144A69C for ; Sun, 11 Apr 2021 03:43:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 74608687F64; Sun, 11 Apr 2021 03:43:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-oln040092073055.outbound.protection.outlook.com [40.92.73.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 46CF66806BC for ; Sun, 11 Apr 2021 03:43:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qa5G2hnsBSH/0zEvL3CNmcukqCorsuNcmueC6QIOH4StZlqMS1g8n/29OZ11rm+HZes9WwzviluVWl8zAlhMIkdCU0jm1SxCCxoLSED5FbHEWkRWSBZxs8BBfBaeFlMuZW15oHkdRfWJCDk50R3qsbeUMa2xRlow1rKN+3I9/2XXETyaAn/1yQ4ILny2qJrPG/Axh/t0Zvl9a8cR4BOJkHnFwtj1zgQ4aodIeZDX65oDyo5b8oUoy0cCHwhDVCjrcyuOBLOr8ktBbsmISvHzzBPss4vkHRv1F19Plt0jiVNWq9LR++uPnRpznBGHqRRz/Qtmiex4+P+B5BxshKzzxw== 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-SenderADCheck; bh=G8bj621DlFlcQEgejkjf6wYes/7lqbpQ9gu8TwU7SA4=; b=kzw4zaOJ7DBo0NCteuHUSe60eXqIFP6sRnrLwit98Qd8hAZbR2MF/CCWX1EoypfE+cQK367rW2fqFw0BNWmsxzyq1egPMq9JYpWebba/9mST6JaARNs7lDO+to4arpIMvFm9Sk+nIwwkD95JYph8emLEIgBYrCt/MPr2Rgm4h2e+bIJ9lWDhj3DXlDkurUgU16bXgya1B+lrFXBGDo/OHRkJIxn3Sw56bMW8pCLgzudXYYkzxo73+7Ak9pVDVDXsYRTpDrj/aMW/+HgBB0fHA4Zy3NW2I4CdMUxJar07omqBgtGHf2nZTJYCED0bIfhpMFBOr/YMjIPkzIcBtshL2A== 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=G8bj621DlFlcQEgejkjf6wYes/7lqbpQ9gu8TwU7SA4=; b=RQj4/P/8Oc3R3nZIT67ZyDKbPcrjh6n72rukl4cCr6cNY0Mywavfb1GAH6Wmc248WXn9FvOanxmLqa4A132qvKi4zYV/2zsUEPKZLOf3w35QuXmhn0Gzv5Uy+9sundHeJ8M6YsFGCraXLRwtnWy4Ftmjwu8hkJ1XqVeo4/PBc1w0uiyxZfj1KdfBgmlQV9PPtxBeH+qUZfW9gs3BVGLrVdSy39UOuQQwQHpOlkyUJWdC2Kbf7MYEaNAo11b8MCnOYOBCsPup6nUP4cZecct9xDz4QYKR5f+LLuaPpoAZ+8G7/QQWx+EZA1eutwsFFiaw285dZ1/RGC8T45agS4hhcA== Received: from HE1EUR04FT003.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::52) by HE1EUR04HT223.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Sun, 11 Apr 2021 00:43:16 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e0d::4f) by HE1EUR04FT003.mail.protection.outlook.com (2a01:111:e400:7e0d::273) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 00:43:16 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:44B1524947A27FA663B02DD58AB30B037765E91171584504ED75D2A692CF20E6; UpperCasedChecksum:4265CB7CFF750759214E79B569FE105EF143D04870113BB9043FF6CE8400C194; SizeAsReceived:7565; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.4020.022; Sun, 11 Apr 2021 00:43:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 Apr 2021 02:43:02 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [cday667DNprIyk4kQ9n6IY7LZXIogdNM] X-ClientProxiedBy: PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210411004302.219786-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sun, 11 Apr 2021 00:43:15 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ab52e61d-0f4c-4256-5e87-08d8fc82cb48 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UI1RSyJFTWTBofyzhLauo4kGfKH7Rhw2ZzcmLNRz0Na+fAEpq+Iw0231ORsDSKuv+J0+G4Xa1RX1C7lh01BEOLKuNDIzw4TDXSHkYWU1dn9FgFMvDPAHy26zlqxRam2KvlAHuwg/ho9LX6+SUDJo7jxlR86fYD+m/cKd38jA8t65dOiWDroTnrJrv2TITEpsql5BJVX3vtsujSDXEIerHnt3sFNoqttSKQWzCWffO6CKeALJmYpmPFyhz80Exe5GFKaJnb49pehgoU202QTpxFqz2/j2qF7BWqXUYOAggVTeoh6kaPG9IWL1g0urN6RIcDDzX2/2elevbKFMuVLkAw5gBKrS+vRPGAwTj2wshL+YY84pZuKPvTSQfCnYJXYWv8gqV03FaVzDeUCNIleftrdMm2F108FRbuvRoapfeU+UMuZBCslPnzqzSx/wylMhUquUCQnTA1Xu4XhUQxRmeeZDOrlqJnKsN4BWVkqsjd/2XRGgJSBZ2Go0+PX+Q1A2Z4/HI5gz4EzFcnbXJpZM/KyxFFT9P4XuGu6MS5I3nFesWkVpln7w+IwgRU6aPWWRYCdXoJ//aHuYZ/FQbVDyE2Cs7fA2qIx28rNbzNl2dHccwhpB+DwO831G8uE0JAVC0eycOgzEYD2nuAeJoBLC4e2S8tgjTT+DI1gm9n28i+K5dk/mv4qPs4aIsa7snQv3eXnzKV4zUFWrg== X-MS-TrafficTypeDiagnostic: HE1EUR04HT223: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j2Z6KiOIqkNllxGO3sNyXyymSuRj3ufqcMJCffBX4OSG3Y/5W8IqTKHkiXLc3+x0Fss6eTgl/dXdcwDZUyG2zpVoNy0VKlyCmANsAv2Y3qgtvUqNHQjbIZnQWUHpiEzjZLuqTNKvGhiiHljQqDZYVGhczgpikenyWQKLUWNypfeFKO3QqAZYR6hwlCpS7b/hEWYYV2sqsYUelscYYzniV117dIWaUcOIBZ2UqFeywcTm9OvaRi7L/KZBCNwmvJuqElSfjlj670suC1OLVRjxFrad9Gov2j72oD0nxqbm4nLdriWmaCxyBiimKH9ZtC+2XKeD3q+rn7CwmMTjurqtKe/+FZKYE3U/MYsVfX18zYSugjff1En6ryQsS/0ur6OrznIdcfOY8CEObJSke30aRg== X-MS-Exchange-AntiSpam-MessageData: /F2KXKxMp6BpYygid+m/ODozXlfAtW+l0iUpyz4DHwK0lG3Zit5QXEjArzA1C2vdy/5IzIGT+0o01h/Y8Nt8fotkZOGhelZ4m/i2tdjQHp9AnjJ1Ov8hxSaWLR2/yUBMKn67aXcerIWXS2ULCOUHuw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab52e61d-0f4c-4256-5e87-08d8fc82cb48 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 00:43:16.0950 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT003.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT223 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/webpenc: Check seeks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" When writing the trailer, the WebP muxer unconditionally seeks back to the front to update some elements. Yet this doesn't work if the seek failed, so check for this. (This has been mentioned in ticket #9179.) Signed-off-by: Andreas Rheinhardt --- libavformat/webpenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c index 3962986c32..a24920d181 100644 --- a/libavformat/webpenc.c +++ b/libavformat/webpenc.c @@ -174,8 +174,8 @@ static int webp_write_trailer(AVFormatContext *s) if (w->using_webp_anim_encoder) { if ((w->frame_count > 1) && w->loop) { // Write loop count. - avio_seek(s->pb, 42, SEEK_SET); - avio_wl16(s->pb, w->loop); + if (avio_seek(s->pb, 42, SEEK_SET) == 42) + avio_wl16(s->pb, w->loop); } } else { int ret; @@ -183,8 +183,8 @@ static int webp_write_trailer(AVFormatContext *s) return ret; filesize = avio_tell(s->pb); - avio_seek(s->pb, 4, SEEK_SET); - avio_wl32(s->pb, filesize - 8); + if (avio_seek(s->pb, 4, SEEK_SET) == 4) + avio_wl32(s->pb, filesize - 8); // Note: without the following, avio only writes 8 bytes to the file. avio_seek(s->pb, filesize, SEEK_SET); }