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 62ECD40FEF for ; Wed, 13 Apr 2022 15:48:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C7C0068B3A2; Wed, 13 Apr 2022 18:48:32 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D8F4768B2CE for ; Wed, 13 Apr 2022 18:48:25 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 42DE1240179; Wed, 13 Apr 2022 17:48:25 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id w83iHkg-aw35; Wed, 13 Apr 2022 17:48:24 +0200 (CEST) Received: from lain.red.khirnov.net (lain.red.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.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9BA5F2400F5; Wed, 13 Apr 2022 17:48:24 +0200 (CEST) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id E1D931601AD; Wed, 13 Apr 2022 17:48:24 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CAS8PR01MB79446CA20AC237C1CAC32F588FEC9=40AS8PR01MB?= =?utf-8?q?7944=2Eeurprd01=2Eprod=2Eexchangelabs=2Ecom=3E?= References: =?utf-8?q?=3CAS8PR01MB794407382EC42678297ECB248FEC9=40AS8PR01MB7?= =?utf-8?q?944=2Eeurprd01=2Eprod=2Eexchangelabs=2Ecom=3E_=3CAS8PR01MB79446CA?= =?utf-8?q?20AC237C1CAC32F588FEC9=40AS8PR01MB7944=2Eeurprd01=2Eprod=2Eexchan?= =?utf-8?q?gelabs=2Ecom=3E?= Mail-Followup-To: FFmpeg development discussions and patches , Andreas Rheinhardt Date: Wed, 13 Apr 2022 17:48:24 +0200 Message-ID: <164986490489.24258.10809421738885762835@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 3/4] avcodec/avcodec: Don't reset decoder-fields for encoders when flushing 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 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 Andreas Rheinhardt (2022-04-13 16:49:51) > Signed-off-by: Andreas Rheinhardt > --- > Needs to be applied before > https://ffmpeg.org/pipermail/ffmpeg-devel/2022-March/294507.html > or flushing an encoder will segfault. > Btw: All this stuff is unused by subtitle decoders, > so one could condition the else on that and avoid the allocations. > > libavcodec/avcodec.c | 23 +++++++++++------------ > 1 file changed, 11 insertions(+), 12 deletions(-) > > diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c > index ded6b5b307..0d971a61d4 100644 > --- a/libavcodec/avcodec.c > +++ b/libavcodec/avcodec.c > @@ -422,6 +422,17 @@ void avcodec_flush_buffers(AVCodecContext *avctx) > } > if (avci->in_frame) > av_frame_unref(avci->in_frame); > + } else { > + av_packet_unref(avci->last_pkt_props); > + while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0) > + av_packet_unref(avci->last_pkt_props); > + > + av_packet_unref(avci->in_pkt); > + > + avctx->pts_correction_last_pts = > + avctx->pts_correction_last_dts = INT64_MIN; > + > + av_bsf_flush(avci->bsf); > } > > avci->draining = 0; > @@ -430,22 +441,10 @@ void avcodec_flush_buffers(AVCodecContext *avctx) > av_frame_unref(avci->buffer_frame); > av_packet_unref(avci->buffer_pkt); > > - av_packet_unref(avci->last_pkt_props); > - while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0) > - av_packet_unref(avci->last_pkt_props); > - > - av_packet_unref(avci->in_pkt); > - > if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) > ff_thread_flush(avctx); > else if (ffcodec(avctx->codec)->flush) > ffcodec(avctx->codec)->flush(avctx); > - > - avctx->pts_correction_last_pts = > - avctx->pts_correction_last_dts = INT64_MIN; > - > - if (avci->bsf) did you drop this check on purpose? -- 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".