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 2AF01491DE for ; Mon, 5 Feb 2024 16:59:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3391E68D150; Mon, 5 Feb 2024 18:59:57 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E4F4868D139 for ; Mon, 5 Feb 2024 18:59:49 +0200 (EET) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=TSif6hDZ; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 2E319240DA9 for ; Mon, 5 Feb 2024 17:59:49 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id XFyvukvJr77I for ; Mon, 5 Feb 2024 17:59:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1707152388; bh=ipXTR/Krwee3+xRkxV0AVHPBTuFnZaLf3E6549DWjyE=; h=Subject:From:To:In-Reply-To:References:Date:From; b=TSif6hDZet+Ay0igFr7CM/70Y3SatoFbh21gc43i79NmDF1LiKZ8ordh4vZ1yZaHs 0MehyKEkikGcHJ8LVu9A+YekyQcF4s8lyXwIwBQrkn/HjTSwAIjtgxyYT6hCy71DHv vIPYpeFiww0RswLDnXgUNlcKQFl+8RHpbkKydxop7Y8juLjvsfw9VN3DJe2vzSFA32 FTqSp33c7OAsFlDQCklELz9JN101yJIm2bh2E5nvPFIhGymdR2k3lclCQlI9KCtiI8 6ubSofjCkmjA9W1BGf5hm0YWvpXdB/ws18sJ30Re0OucAuwc0LkkDwrZFesoZHxVSg lSwCcV5B7a6TQ== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id A0A77240177 for ; Mon, 5 Feb 2024 17:59:48 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id AA01B1601B9; Mon, 5 Feb 2024 17:59:42 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <6ff407df-2176-47b4-a0d9-fae44af3df77@gmail.com> References: <20240201082938.16687-1-anton@khirnov.net> <20240201082938.16687-3-anton@khirnov.net> <6ff407df-2176-47b4-a0d9-fae44af3df77@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Mon, 05 Feb 2024 17:59:42 +0100 Message-ID: <170715238267.8914.17230076966978548404@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 3/4] lavf/demux: stop calling 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Leo Izen (2024-02-03 03:35:45) > On 2/1/24 03:29, Anton Khirnov wrote: > > Replace it with recreating the codec context. > > > > This is the last remaining blocker for deprecating avcodec_close(). > > --- > > libavformat/demux.c | 53 ++++++++++++++++++++++++++++++++++++++++----- > > 1 file changed, 48 insertions(+), 5 deletions(-) > > > > diff --git a/libavformat/demux.c b/libavformat/demux.c > > index 6f640b92b1..c1640c459c 100644 > > --- a/libavformat/demux.c > > +++ b/libavformat/demux.c > > @@ -1250,6 +1250,52 @@ static int64_t ts_to_samples(AVStream *st, int64_t ts) > > return av_rescale(ts, st->time_base.num * st->codecpar->sample_rate, st->time_base.den); > > } > > > > +static int codec_close(FFStream *sti) > > +{ > > + AVCodecContext *avctx_new = NULL; > > + AVCodecParameters *par_tmp = NULL; > > + int ret = 0; > > + > > I believe we can drop the initialization from avctx_new and from ret, > because avctx_new is assigned immediately, and ret is assigned before > each goto before it's assigned properly. It's safer wrt future modifications of the code, e.g. if someone would insert something that could fail before allocating avctx. -- Anton Khirnov _______________________________________________ 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".