From patchwork Thu Mar 21 12:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47289 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp514851pzb; Thu, 21 Mar 2024 05:34:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWUnQ36bghzAoovs0flHRCTPOb/n/qzTRjsj21Ovmqmif0cMMrquu9fw8TritM3H23WcFp4Sm8hWF8nlUC1238I3uJdoRMpKDEQZw== X-Google-Smtp-Source: AGHT+IHsti09BtZW9Rof/gllCkwUlqPz848GiYhQxo4A7csRag8m33rqrnxH5qplTLSOyCFWyQ6N X-Received: by 2002:a17:906:74f:b0:a47:1b25:a7bb with SMTP id z15-20020a170906074f00b00a471b25a7bbmr796506ejb.4.1711024469846; Thu, 21 Mar 2024 05:34:29 -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 d19-20020a056402401300b00566e07a0f4csi7557592eda.498.2024.03.21.05.34.29; Thu, 21 Mar 2024 05:34:29 -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=IwBJWpZZ; 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 0D6FE68CB56; Thu, 21 Mar 2024 14:34:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2060.outbound.protection.outlook.com [40.92.91.60]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A03268CB56 for ; Thu, 21 Mar 2024 14:34:18 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U+avrLFfeidjjZ+SBmfTHzGmc4+v3VZIilGA/592LkEASvcmfsLLKqN5mgaHZPvs8G9PvGpb5tvBFIVRqlfRbvttgjYzOKMN1GJJC5k1MeKBh2nXWFfZlvFi2mMiUJB0yvoxIsFjqjp6LR5qaJA/3ubnXL9FN0T2D775swLSZV36d/51OHoh8t4lmWN0Px4ITeXhHUZOQhJqj7hAfxV+ij6NZPAhE0WXWzMk4g5S6F7m3cm5Hpw3z8e+8EKDNje6ouVEKkQ95lUOW5ca0bDIQf1o8Q1cvdl5eznRiHjJduovQOGkUNqK6CL6kNVJ7eW/QTkbzXSIc1d75h2i4hQAfA== 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=QQKBqvI0Vatl3jDUArvN9p2E5W1xhmrfrU4hhFfDLYo=; b=W4scCICjQHcs09530BxF8kGkddYe9xWHlnTbDWQ70bvKyQ1znZqGRfxBLAdv2LGdencCGZAIyt/zo7rjEC8PY8er6fC87pJtv4CR/Y1r918i091Wznu1+dqoD9k5U9qJMdZsfipMG+dMczaiOnj5MbMvTlkWfKkQtO2SF1sc6+yi1NaEAejO9QD3YivojT1+tjjkbFnK8YrG1ziIuNPg0WtB9NXIi86PtInW/Zkx/lzGqplc10aX3wjStscgvXdBh72pWL/y1bBMx3UZgrFhc4FlUvbCfFsroZYi7mjbpZCgdqr3yaCIXg82e57ZW1yHtlsP0XK2WPNojyH6j6MV+w== 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=QQKBqvI0Vatl3jDUArvN9p2E5W1xhmrfrU4hhFfDLYo=; b=IwBJWpZZCr3GBjMgUoGHXGSTfGkE34NVFMnc4tfMClvxJ+KDj3qnyAAxSnU82kuiKg0VixfX3Scoi4j2bFSCut4xGkzit4C0oAS5uGgCmXQTZJWJ5o1nRy5yY2y7xCSvQvThYWUezeGvi4ddjjxLYltp8mnpTKYCMCR3NUJJB9sD7MJgJUqsqQHGosf2jj5qxRj704LtJSl1iwlRuZVnyoJcxkj6tYjpGYh7HPIZvXKm7paf/sRL3rlQq2iG2EnRccmX2VrzU1tUzPxSSlMx6Fgybv73lNS/cvJQm/94Pacw/kzyOcWJvPGkhDRU9v07oUvZxfC1Yd7TXocC8jSZOQ== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by AM8P250MB0075.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.31; Thu, 21 Mar 2024 12:34:14 +0000 Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::8230:ffad:27e5:20bf]) by DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::8230:ffad:27e5:20bf%3]) with mapi id 15.20.7362.035; Thu, 21 Mar 2024 12:34:14 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 21 Mar 2024 13:34:05 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [3N3lZB9Zv7q0uKmKXYsQt5MmEozVcZlcvoouXeJCn+s=] X-ClientProxiedBy: FR5P281CA0037.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f3::17) To DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) X-Microsoft-Original-Message-ID: <20240321123406.499087-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|AM8P250MB0075:EE_ X-MS-Office365-Filtering-Correlation-Id: f2c82d66-9519-4d93-979a-08dc49a3377e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qPFe+VbmOL6kf3pP8F3DBsph+r7RXKdTQmQVT6WWzIFC7TH4ZSUpEmRuWmscDPrvhRLYjh1kRcp6bmwmRJ15NkXyc2MzKOhUzw+fBhE/xN6VVugufKTva8ogis3aLkWwBSfsssB/CQaKXWb1PLaiipZ/RFG2Oy8j5WJPC4U4+cm0Uh0sarCHH+43n4k/siUXDPqmd1KYtWCJxZ5t4ucKeFsqAOQtgLNz0KxAMSgEVsin3a7nbPUnlK/vQ4adEpJLe6LsVZzJQ71kSFdSdZL5ntveaeT8QUOrjMg8OSAT38GrL5TSXbpv81eWk2AU2lweWkvXBp2QPG/jUnTKHpiSRM7uEVCXcfVeiQnMte/yGPFbZ4WKL4e8ODH8ie7WVLiWy+j4LluyNfR0iyj0FVKwlXjvOnUUJxOdft9OcL7CcZz/lFMsFY63T78LK/Iv/sogAh1NdkQbEKToLolIvLp2lGXtmU9h7cLGBTBLocnAadks5L2Aj6BJYzPqBkfyMu3YTCoVp8ZlYoryhS6YNJViFlMUYIYUQdytTk8DB7Gak4JGqcrJCJAxSra4tJB9457YFWTJ2RAcQ07YGtW2mKIFt1n9OIUU9lE2ppOhsKTPpEMSf0VZmKijHBiqCNu3UP0Q X-MS-Exchange-AntiSpam-MessageData-ChunkCount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dxSmBDSGy7OpPpqAcgzpzH3jELXV5kzwynTQPkmrb9XvfnBE7hVVhL7j/7MkqXF/R+JP2tTYoKNZgxDR/MeLBVp/b7I+BkMBdZcFJkQDGOLQc8G4aT0MjUvg171iQAlWkI+EO+E5Nlqo/HxEBeT5ugHOli3D1MiHme0WmpIyNUQMyDqKmmGgzoaDyPQF9vlkBf6ycUXQsWu0+DYkRmIjYXc1SUqaucyNBmMSkjOgvUoDMq+DaKkTsxXEn4TPA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2c82d66-9519-4d93-979a-08dc49a3377e X-MS-Exchange-CrossTenant-AuthSource: DU0P250MB0747.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 12:34:14.1205 (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: AM8P250MB0075 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/demux: Restore pkt->stream_index assert check 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: tX+kU2NK+Ocx It has been moved after "st = s->streams[pkt->stream_index]" in b140b8332c617b0eef4f872f3ef90c469e99920f. Deduplicate ff_read_packet() and ff_buffer_packet() while fixing this. This also fixes shadowing in ff_read_packet(). Signed-off-by: Andreas Rheinhardt --- libavformat/demux.c | 75 +++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 4c50eb5568..4345ed4c8c 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -532,9 +532,6 @@ static void update_timestamps(AVFormatContext *s, AVStream *st, AVPacket *pkt) { FFStream *const sti = ffstream(st); - av_assert0(pkt->stream_index < (unsigned)s->nb_streams && - "Invalid stream index.\n"); - if (update_wrap_reference(s, st, pkt->stream_index, pkt) && sti->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET) { // correct first time stamps to negative values if (!is_relative(sti->first_dts)) @@ -555,13 +552,24 @@ static void update_timestamps(AVFormatContext *s, AVStream *st, AVPacket *pkt) pkt->dts = pkt->pts = av_rescale_q(av_gettime(), AV_TIME_BASE_Q, st->time_base); } -int ff_buffer_packet(AVFormatContext *s, AVPacket *pkt) +/** + * Handle a new packet and either return it directly if possible and + * allow_passthrough is true or queue the packet (or drop the packet + * if corrupt). + * + * @return < 0 on error, 0 if the packet was passed through, + * 1 if it was queued or dropped + */ +static int handle_new_packet(AVFormatContext *s, AVPacket *pkt, int allow_passthrough) { FFFormatContext *const si = ffformatcontext(s); - AVStream *st = s->streams[pkt->stream_index]; - FFStream *sti = ffstream(st); + AVStream *st; + FFStream *sti; int err; + av_assert0(pkt->stream_index < (unsigned)s->nb_streams && + "Invalid stream index.\n"); + if (pkt->flags & AV_PKT_FLAG_CORRUPT) { av_log(s, AV_LOG_WARNING, "Packet corrupt (stream = %d, dts = %s)", @@ -569,13 +577,19 @@ int ff_buffer_packet(AVFormatContext *s, AVPacket *pkt) if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) { av_log(s, AV_LOG_WARNING, ", dropping it.\n"); av_packet_unref(pkt); - return 0; + return 1; } av_log(s, AV_LOG_WARNING, ".\n"); } + st = s->streams[pkt->stream_index]; + sti = ffstream(st); + update_timestamps(s, st, pkt); + if (sti->request_probe <= 0 && allow_passthrough && !si->raw_packet_buffer.head) + return 0; + err = avpriv_packet_list_put(&si->raw_packet_buffer, pkt, NULL, 0); if (err < 0) { av_packet_unref(pkt); @@ -585,14 +599,18 @@ int ff_buffer_packet(AVFormatContext *s, AVPacket *pkt) pkt = &si->raw_packet_buffer.tail->pkt; si->raw_packet_buffer_size += pkt->size; - if (sti->request_probe <= 0) - return 0; - err = probe_codec(s, st, pkt); if (err < 0) return err; - return 0; + return 1; +} + +int ff_buffer_packet(AVFormatContext *s, AVPacket *pkt) +{ + int err = handle_new_packet(s, pkt, 0); + + return err < 0 ? err : 0; } int ff_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -612,9 +630,6 @@ FF_ENABLE_DEPRECATION_WARNINGS for (;;) { PacketListEntry *pktl = si->raw_packet_buffer.head; - AVStream *st; - FFStream *sti; - const AVPacket *pkt1; if (pktl) { AVStream *const st = s->streams[pktl->pkt.stream_index]; @@ -656,36 +671,8 @@ FF_ENABLE_DEPRECATION_WARNINGS return err; } - if (pkt->flags & AV_PKT_FLAG_CORRUPT) { - av_log(s, AV_LOG_WARNING, - "Packet corrupt (stream = %d, dts = %s)", - pkt->stream_index, av_ts2str(pkt->dts)); - if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) { - av_log(s, AV_LOG_WARNING, ", dropping it.\n"); - av_packet_unref(pkt); - continue; - } - av_log(s, AV_LOG_WARNING, ".\n"); - } - - st = s->streams[pkt->stream_index]; - sti = ffstream(st); - - update_timestamps(s, st, pkt); - - if (!pktl && sti->request_probe <= 0) - return 0; - - err = avpriv_packet_list_put(&si->raw_packet_buffer, - pkt, NULL, 0); - if (err < 0) { - av_packet_unref(pkt); - return err; - } - pkt1 = &si->raw_packet_buffer.tail->pkt; - si->raw_packet_buffer_size += pkt1->size; - - if ((err = probe_codec(s, st, pkt1)) < 0) + err = handle_new_packet(s, pkt, 1); + if (err <= 0) /* Error or passthrough */ return err; } } From patchwork Thu Mar 21 12:34:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47290 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp515083pzb; Thu, 21 Mar 2024 05:35:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5biECe7XLCAJnHkSspM6FXlj4lwDiMAOEhwLZT8oX4PuYlhr3F0pDBf/s2HpRF1F6Pi7lzY+9/EBm0jUI4gUdbRgRwpsljK3CxQ== X-Google-Smtp-Source: AGHT+IEF0eUiBOL6270qXKlqzjk+g8pKenHgdgnZel4zA6s0MN5Smdk++K3kjPABNPVeZ1NHQBOB X-Received: by 2002:a19:ee14:0:b0:513:aef9:5401 with SMTP id g20-20020a19ee14000000b00513aef95401mr14335982lfb.66.1711024500879; Thu, 21 Mar 2024 05:35:00 -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 em7-20020a056402364700b0056bcd7de32esi439224edb.663.2024.03.21.05.35.00; Thu, 21 Mar 2024 05:35:00 -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=JNRGSxqN; 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 4434068D545; Thu, 21 Mar 2024 14:34:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2012.outbound.protection.outlook.com [40.92.90.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3516C68D536 for ; Thu, 21 Mar 2024 14:34:51 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ITnFVRe3ttAE5M1PRSbaK5UxMudMMvo8owIW6kxX217Qp6ld0Ty8JCtrjmAXuarSUYnhFRvf7/3Cngn3n6O7QEQo0LjF12IGEF0XWd71mne9QncIOKP6eIX9mTbvsvekomlu6Bg8bonmSQBugxEGIb5dJzZqBu3UK5c4H5SByL0kuPTm3PMUWJyZNRnDCi0oLTQoaP3ZD5Q6UBJRbfmHZUxVNBCEtQPghsscHsTbJRACH77A7wEX7Bwo4lU58qpfMuuHRJIiSXDxSWtbjljDiiYtLoDBz0BYKlz8szMRSemMOCO3VN/V5Vr38Pnpf6+a924qF4NKftUsP5ki4ZdAag== 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=dFuLal9vUAtfTZmNnwFBfICvc7Uz9O4M3tlqajARQWc=; b=j99evQU3UeOOG0KOjNzlOUzqHdOL8dAaDBPvuaSBJEoBoN/ZkX93kdLoWDmUf76lQFTtsuupgj9r9nnlw5FwRIihYh5KIAoqS9Wxk3Dh/fNMkSPP3BXyva8LrHx83qiz+2z6JsoONEzMMkBM/OvKbY+20IBZioJLvdve9UluzwkPin64RXkbPEOi9ScQtk7Z3bioHyArR5sdxTmyrrh3oeN2T8L4jtaILYn2dHvwqVq6HMMUolrO7AH5uWC4aHzlvsfDuLOS8OUl0cPPFCcE8D53zaXJ9XFsIlWJrHCj/eFoKAIc/xjrUG6JWuIqzSHL2Pb7wLbKJENpo2lDF3zpcA== 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=dFuLal9vUAtfTZmNnwFBfICvc7Uz9O4M3tlqajARQWc=; b=JNRGSxqNuhXld0cm7zkjxf+W98srE8pkMXbJ6fGV1zEqC9t8Y1v9YzT3xe+PKOk/r/jzMuDWZMMQ413I3pLv92377fYYNUjJ8rvPad1ipgLCRPAjLd0/6u/77R4tht+7xM3IIxXIbVTycHgGzTnmnoo8XRRhGYmEXc/uvcQRa24FgwH9Ls7kFS4WXAhC0ANc6rFVqhfBZU5ObvBR0niCXwCVQkLkxUjeTeH0ycungHdg4v/wnTx3oLQgaJIXfey4+24Ende9FlfWXEnrdfQJhCk4obgi9DJ62PehHOuZtOhx9gfTcrG7QZwmo8vPEmv6c6tiBRowEc5b8yY9D/sWXg== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by PR3P250MB0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:14c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.30; Thu, 21 Mar 2024 12:34:49 +0000 Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::8230:ffad:27e5:20bf]) by DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::8230:ffad:27e5:20bf%3]) with mapi id 15.20.7362.035; Thu, 21 Mar 2024 12:34:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 21 Mar 2024 13:34:42 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [+CLUkO+X9sTQ9JLCmCgSrzWEHQyhi6ziqPfg+48zKPw=] X-ClientProxiedBy: ZR0P278CA0162.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::13) To DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) X-Microsoft-Original-Message-ID: <20240321123442.499127-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|PR3P250MB0001:EE_ X-MS-Office365-Filtering-Correlation-Id: 12666833-9330-48c3-af7f-08dc49a34c95 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bLTM1YftGm52pxfSR8XQUMaUkOhQlnw2vbw8RssI6B8PZML68Oa2lS4RlRJuVhh9dOdTau0xqolBdFVLrcRvj1TUylG+gnfvTMS/idhARZMagcAiZNft8YlH1cRMjN0d55KUIPkjbRmFtvRqAovh4Lnk/VLwFARh6P7zvqOz4fllhZfhKWrX4sCtNUzL+pbkL+2pwXp33xLrH1UJH9J2XCY7RnGLlsyEt8qkpD5AryUQPqx0FYtc15+yXBt39XJxGzFvo04gcGDB1f26J2xoCeTn0ZhA4seQMuV7+te0NUwffSjlXZmEIHOMRo05C93smRxpIycjHexj4qAlyeZaPUOf/pO16iwJqQAuPBf6Lc5DFRhAYBmIkO8/Rv4ezGkDKOsdvIgTPexj2tdSQak5nWlE3FlgR9bu7Sf+4JPAVVfdBE5MT+uhHYNGAr40MxZVEL18KaoxBFADCiS1qHCG7KQ3EnqdA3y3NOc082pY6K24k4rZIMVymrO3jl+N3xlAdyusEacG06g/KG+f6qqfp1cwkHTVq0A+86vl0Yf6PvIMX9MKhNCGNFH2gYynBIPlWamTHTstnJwjtpyoIyKYzM7GL1x6sdYVrBmoCt1KytIeHSDoCxAk3qkz+K2ud6Dg X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LOHHwD54/3hoDfZ/KNBIgwulveUdVDI5jhM6B3oeDBha3dZKDVo7w8+LYDwXxu3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apG4AoMZAXTbg0yz8YUN6pRckInuRqy48Nxr/8bWeg9Ahj+uUxj4/yxlSU/JA2+zWxTGXaPuFGTeMVTJ9YMuVbhlUd1K7QS8NhWh6erLpRyQy18XjP1Jj0dZxHKK3co+35vjPRW/P7oSCoFZRSY8lRbNXK185ew== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12666833-9330-48c3-af7f-08dc49a34c95 X-MS-Exchange-CrossTenant-AuthSource: DU0P250MB0747.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 12:34:49.6229 (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: PR3P250MB0001 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/demux: Combine "Packet corrupt" logmessages 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: wxPTaQQu75+D Otherwise these statements might be torn apart by av_logs from other threads. Signed-off-by: Andreas Rheinhardt --- libavformat/demux.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 4345ed4c8c..e50d1a9cfe 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -572,14 +572,13 @@ static int handle_new_packet(AVFormatContext *s, AVPacket *pkt, int allow_passth if (pkt->flags & AV_PKT_FLAG_CORRUPT) { av_log(s, AV_LOG_WARNING, - "Packet corrupt (stream = %d, dts = %s)", - pkt->stream_index, av_ts2str(pkt->dts)); + "Packet corrupt (stream = %d, dts = %s)%s.\n", + pkt->stream_index, av_ts2str(pkt->dts), + s->flags & AVFMT_FLAG_DISCARD_CORRUPT ? ", dropping it" : ""); if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) { - av_log(s, AV_LOG_WARNING, ", dropping it.\n"); av_packet_unref(pkt); return 1; } - av_log(s, AV_LOG_WARNING, ".\n"); } st = s->streams[pkt->stream_index];