From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 68E1640295 for ; Sun, 20 Mar 2022 19:06:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB0A668B058; Sun, 20 Mar 2022 21:06:07 +0200 (EET) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6376C68A43A for ; Sun, 20 Mar 2022 21:06:01 +0200 (EET) Received: by mail-ot1-f52.google.com with SMTP id k25-20020a056830151900b005b25d8588dbso9256229otp.4 for ; Sun, 20 Mar 2022 12:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:references:in-reply-to:content-transfer-encoding; bh=HD+uQeUoO8A2Cnfa9kTdWbpk2VVZrP+Z5TjTZlIiTH4=; b=avO5d9DFUfok3SHKcfclX7Gq1z/fDsLO7q5vIlA/A7iIp9LlAbLQ5XXA9IwRRL0snL Pp7IAMYSCPRdV8qNdDzQFQ8rxXqwuS3+4925Yr29RecmtWzKV3Lh5TvLUSyiETaD0SV1 rQ/RTc5oIJAxodTwlFyOrG0RtfTk9wfTqypm8GTfsqT+hblrKoyLBe9TU1Ok+5D00YqT 4IdkxacuLHgZYqPO9BobdST9iCQdtKlf0oME6qB295VlSUPXI2eegPTuIpP3rICPl394 vHCTwIUt2cZrZp5fZIK1HvI7mGvJh7/yo0NKvMSy1efti7+aLZ30F3VbnJ9yE7KMkLfn Mkrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:references:in-reply-to :content-transfer-encoding; bh=HD+uQeUoO8A2Cnfa9kTdWbpk2VVZrP+Z5TjTZlIiTH4=; b=Kt9w/MWA+xz0tr0zW0NBoR+Nrssf4tY0zs6OGHFnsl4szRjxB1XK6//sRFHT2V8RqO NjYDJg353BkVIhz2Amf83Wfm5xp/el9WR6hy9oHl5MGL1AoNST2FT1fvoUABVyXSsWeT lK7cQtmpbpXY5XY3tx4yBEp+IEVXFrrmqOq1MmVIYL1bcz2jJCLYzZNKfoB0/W90xlAl u/wtksKr2BGiFr9t+EQyqauLCkbv5nB9qfGh1ikfUYCgCB5zQ5ZZ7uAqPUDUywRfOdJY 8G4KBfu9AMLa5GjoS8hNqdsGnlb1twBSmFHAVKmqAasw1bx/bwXRzaXuKM3RglHdCR2b 2OsQ== X-Gm-Message-State: AOAM532ag22J5KTjl5fK/kvl1joe5jDKTxWh64IGHzpiro6dYPibPWW9 kHh/l1YpqUcjdFlzAbg8yIli3l2RrRuqSA== X-Google-Smtp-Source: ABdhPJxe2ocofJ2EAUBuR+RMDBbJEHgr8nZnkmsNqdpv1W5qvKMyJYblogLqpAU8BfoTLRQb/avv+w== X-Received: by 2002:a9d:65d2:0:b0:5cb:5d55:ae24 with SMTP id z18-20020a9d65d2000000b005cb5d55ae24mr3216997oth.249.1647803159456; Sun, 20 Mar 2022 12:05:59 -0700 (PDT) Received: from [192.168.0.13] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id y67-20020a4a4546000000b0032476e1cb40sm2360171ooa.25.2022.03.20.12.05.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Mar 2022 12:05:58 -0700 (PDT) Message-ID: Date: Sun, 20 Mar 2022 16:06:00 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US From: James Almer To: ffmpeg-devel@ffmpeg.org References: <20220319030407.45503-1-jamrial@gmail.com> <164769762003.19727.8418628331219276771@lain.red.khirnov.net> In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avcodec/avcodec: don't uninitialize ch_layout in avcodec_close() 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/20/2022 2:03 PM, James Almer wrote: > On 3/19/2022 10:47 AM, Anton Khirnov wrote: >> Quoting James Almer (2022-03-19 04:04:07) >>> The function is not meant to clear codec parameters, and the lavf >>> demux code >>> relies on this behavior. >> >> Maybe it shouldn't? >> >> Which code is it exactly? > > The parser included by demux.c. That file calls avcodec_close() in > certain situations, but the avctx is still used when calling > av_parser_parse2() as it's expected that all the parameters are left > intact, and all were until 327efa6633, where avctx->ch_layout started > being uninitialized, and it shouldn't. An alternative is > diff --git a/libavformat/demux.c b/libavformat/demux.c > index c1c9422ac0..c14e44cb07 100644 > --- a/libavformat/demux.c > +++ b/libavformat/demux.c > @@ -2957,6 +2957,7 @@ find_stream_info_err: > av_freep(&sti->info); > } > avcodec_close(sti->avctx); > + avcodec_parameters_to_context(sti->avctx, st->codecpar); > av_bsf_free(&sti->extract_extradata.bsf); > } > if (ic->pb) { Which works around this specific issue, but either way, avcodec_close(avctx) should not nuke avctx->ch_layout. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".