From patchwork Fri Aug 27 14:27:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29821 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1514066iov; Fri, 27 Aug 2021 07:30:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwujFOVv3Z6CnWFwD3f59wk9z9ZRS6yQY3i42oV0nz4b5opiPFcwnK5PlZzVNwlzFqLT+CL X-Received: by 2002:a17:906:2441:: with SMTP id a1mr10462424ejb.550.1630074635180; Fri, 27 Aug 2021 07:30:35 -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 s23si7126655eds.407.2021.08.27.07.30.34; Fri, 27 Aug 2021 07:30:35 -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=t11Tzuj0; 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 21B6568A5BE; Fri, 27 Aug 2021 17:28:12 +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-oln040092074075.outbound.protection.outlook.com [40.92.74.75]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B42B568A3F4 for ; Fri, 27 Aug 2021 17:27:59 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QbohqpNmXAHfKZpwpdWEmv/jVIZwUJQ/SZLkNLGZcLRMnzJWrtUIr4eBSjyBIVkePj802anvYFCbrrLC6KuSw+oqczTal9OGr4Fm9uxvTKl2mAxhxTviZ+Rh8u36lgdy8OE6MxdSiDRtMHiF34B3EcAsbJOEIshljqhkIPkL6lAU3SajCO/PHZWRhzhTPsi10W/Ukjj2UTAtvjMdNDjbKfJWSa1S85BWIBK0dCJB450wT1RI+HozbVexIz86gojhl0Gamja2stbRi8q4mZzzPt246ojbBc3AuxnTQ2/X4/pn41mB+HdUXM7ZIN29J8V6CgBvTIGJ/WYTKDRWkHNqgw== 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=RcMoW9rqdZuVTSUomNGx9Tp/QqmN/AabTqHHpOExMSE=; b=AoYaljM3TeSM3Xi88I4XaM9g9AiP2igFv97WXAQnqB2NO1hoNeyTIUIq/7eYBXufSkl2VHRJwAOHScLlkN3OKMJYXgQXWdfFa8SLeb5bewb0AnyVH6IDph2qvHOP7kx4hpv///4i9nk0J8H5YtnhPeyeVacVAImwlPVkK+fpph8Bg+2ZH63Z73RT/pHxkoEQn4KPPNlwu9sQuIhqIwYvE5nnfDwS2CU6eMiFuTkfEXs4046NI5xuQFYhsvSMRYuIIcZAOhl0YUwSOYHgoC8DR2sX9G6wNXNcB1MJiC/fC0GQsNguQwqKUsd3bXCTPHUOGToB+Eu1mQN/F7ra66wuCg== 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=RcMoW9rqdZuVTSUomNGx9Tp/QqmN/AabTqHHpOExMSE=; b=t11Tzuj07XAyi1iQyNkYN9TGORK6q6EwUSIWRj/P+p361mlhnBGFOPMDPTXVLP9JlU/W6ah/yLOzcpRKNwrTacTwn0cSRspYYvvIzTkG3Qi/vP/M9S7HaU67paHhl8ILTHe5lCIAGxSVq0l2bUO3zyQpb9IPQIgmrxK9e2zGQktt6WiRob/kmfKru6d097t2RxCtrqx76WSq0Cr9Sr4ZqlfZS43qQLTO2eZJcgAMUhcD7ygMSexHClrqpV8tqsuB7AuZSJDpkizFMxrYTJTuCn1yWd8Hp4IMJydUaZeXHK0Tu4XRYhS4mZldmB6McDZGjMj/indpinhz7J0Vs8RRVw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3687.eurprd03.prod.outlook.com (2603:10a6:209:30::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Fri, 27 Aug 2021 14:27:50 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::5574:1fd:cce2:d590]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::5574:1fd:cce2:d590%5]) with mapi id 15.20.4436.027; Fri, 27 Aug 2021 14:27:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 27 Aug 2021 16:27:13 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [QRnmMy8mUhHoY2GCyUUTCrZOGAs1lW72] X-ClientProxiedBy: FR3P281CA0031.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210827142725.645653-12-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by FR3P281CA0031.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.10 via Frontend Transport; Fri, 27 Aug 2021 14:27:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50f6f32f-30ef-42d5-02fc-08d96966d8cf X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEtNCKoPT6rtVE5PzvjguT+vFc6wRHKZk4Shhw2G4KCyyNcii+M08wXIZh0Z8br/EjnIiICSWyfft55fw0NjKH/d+fGeGDL0kiiaxwRt8Gno4aqcSbg+mijeqCGHAGlfhzDlSMUXMicYONMEW1z2ftM9fIlYN1frckCMUahb0lU0YXMVe2MuVex4jvJC6auROzFQ4qNn65qPgV1Ndmga+pqg4y5LNksnGbVK91cHYxJqL70d7TYWceCoDRWa3fb/DzpaS86pQmU9TaBfJBePFZXLWCpaWPgiIDuBxysplFIyQ5v0fzqYk1JTBCnkPGdbZ6bnBpMFeDpx13BrmnHsQbLubPCl84X2JaxwuDKOTkqphAfUTWcbBrdojN02g0MNwyMeyeXBk3tO+rST/GyK1Ur3KvgIpAcNI0ePbflVJ4ZioSPllWXCo0oFr8XZMSzIfsOakwDJcEIIarYRDl/LjdNQdaZbUDTCMYGTfWqXjv/bg9G+hr8E+8UHVLnrLrxRsCJBUrN2DkBeMstLe7gSDjr/Qq6NoKyAIYJtAL15iUrCE2qQcQQZkkVf65wKcKZ4DaZluWUbCzuiMSqMC/lW4iULyXv2MLA8Sy8PZof/0gV1CKP9m8uU4c2kUcoKmQmSjof9LTJLfh5+Zpu0jgVYmvVdusxPONPVla30zefu0MClrgADbXFWfZsKaYMWOtB2DWNexpLCB4DWTZepmtgp/K9fP+vncDKhp9BDXIBza5dv9jVsKc7PqE2d/45C0cRd3gluAkuY+4VI9xmrCA/aCkVi X-MS-TrafficTypeDiagnostic: AM6PR03MB3687: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1+qFxyA0vt35gDRDMu57Iy1Gs2/vjt47JRfHmFcQvWXPArab81iCy4ffJmK0jmlcLpSas/2qjGSKE5xnmWYEPQnivGVbrcvsu951z/R2BYmHVonpKKuIMCJ/iGDadrY/0cI7eI/bxp7OXfCgW/4P0hY2X4+QOhn1Eyh8SPnQdNaLn9FFYcxifkwC1tLyYlluMyV/e6FyqOVESzAMwMdwGQbw3Hpg/LWN7NDQawcuOifEY5d2s8RErDbchSiaq4SCnOBEPt0ChBaHRuCZOaTXKFahSyrzpn+2o5vhgIkyxfbiVUtVqZjix41+EbNfp9EdGL04zifmu69N8CvIZRimgoyUPZUrqM8j+/MnUp8zbl5+KhgV14BhT/oD2h5aJyR5gfUJufhZ9LfAlQUOajW7IEGVuMhiRd/o6O2soIbXKSYgS1NMDjpF7kFtgX+qbRTM X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mtWaiEQA0EcbZCvR1HpGDurWWQGqp9P/+TMgtdjhyEZWsmp9D5XW+wh6KofqG7bdiJt/+bVyGseaiQ0RXCPZlmhIVxi9Q7uxP4w9FUzAstL1DTX71ozY/7Ya5sOO2HPIhGWH45dMTV5jv5mhrYdWpA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50f6f32f-30ef-42d5-02fc-08d96966d8cf X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2021 14:27:49.9401 (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: AM6PR03MB3687 Subject: [FFmpeg-devel] [PATCH 13/25] avformat/utils: Don't initialize AVStreamInternal.info multiple times 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: INSpl7jMq2oM It has been allocated and initialized in avformat_find_stream_info() until fd0368e7ca35e2feaf7960564e61a76655c4d1f6 when the structure was moved to AVStreamInternal and its allocation to avformat_new_stream. In order to also initialize the struct for new streams that only get created during avformat_find_stream_info() said the initialization has been added to avformat_new_stream() later. Due to the Libav-FFmpeg split this has been done twice: In 4cda8aa1c5bc58f8a7f53a21a19b03e7379bbcdc and in 30c26c2442e4e44ac5a763c23c4b0fdd9921a7f5. The initialization in avformat_find_stream_info() has not been removed at all despite being redundant. This commit removes it and the duplicated initialization in avformat_new_stream(). Signed-off-by: Andreas Rheinhardt --- a) avformat_find_stream_info() frees this info field; this implies that calling it again leads to crashes. Moreover, I am not even certain that the calls to ff_rfps_add_frame() that the mov demuxer performs are safe (i.e. happen before any call to avformat_find_stream_info()). b) That info structure should have a proper type to simplify the many 'st->internal->info'. libavformat/utils.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 79fa9382cf..8cbe2a0278 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3624,14 +3624,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_dict_free(&thread_opt); } - for (i = 0; i < ic->nb_streams; i++) { -#if FF_API_R_FRAME_RATE - ic->streams[i]->internal->info->last_dts = AV_NOPTS_VALUE; -#endif - ic->streams[i]->internal->info->fps_first_dts = AV_NOPTS_VALUE; - ic->streams[i]->internal->info->fps_last_dts = AV_NOPTS_VALUE; - } - read_size = 0; for (;;) { const AVPacket *pkt; @@ -4379,7 +4371,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) st->internal->info = av_mallocz(sizeof(*st->internal->info)); if (!st->internal->info) goto fail; - st->internal->info->last_dts = AV_NOPTS_VALUE; st->codecpar = avcodec_parameters_alloc(); if (!st->codecpar)