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 DE526476F5 for ; Fri, 20 Oct 2023 15:23:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80CB668C69A; Fri, 20 Oct 2023 18:23:36 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 62EA868C69A for ; Fri, 20 Oct 2023 18:23:30 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 1ED0E240498; Fri, 20 Oct 2023 17:23:30 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id tyKO8vJQuITC; Fri, 20 Oct 2023 17:23:29 +0200 (CEST) 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 73FD82400FF; Fri, 20 Oct 2023 17:23:29 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 4E47A1601B9; Fri, 20 Oct 2023 17:23:29 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: Mail-Followup-To: FFmpeg development discussions and patches , Andreas Rheinhardt Date: Fri, 20 Oct 2023 17:23:29 +0200 Message-ID: <169781540929.30698.17624996838550323031@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/pthread_frame: Remove ff_thread_release_buffer() 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 (2023-10-20 16:33:06) > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > index c02408548c..1a4339b346 100644 > --- a/libavcodec/av1dec.c > +++ b/libavcodec/av1dec.c > @@ -636,9 +636,9 @@ static int get_pixel_format(AVCodecContext *avctx) > return 0; > } > > -static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f) > +static void av1_frame_unref(AV1Frame *f) > { > - ff_thread_release_buffer(avctx, f->f); > + av_frame_unref(f->f); > ff_refstruct_unref(&f->hwaccel_picture_private); > ff_refstruct_unref(&f->header_ref); > f->raw_frame_header = NULL; > @@ -689,7 +689,7 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s > return 0; > > fail: > - av1_frame_unref(avctx, dst); > + av1_frame_unref(dst); > return AVERROR(ENOMEM); > } > > @@ -699,12 +699,15 @@ static av_cold int av1_decode_free(AVCodecContext *avctx) > AV1RawMetadataITUTT35 itut_t35; > > for (int i = 0; i < FF_ARRAY_ELEMS(s->ref); i++) { > - av1_frame_unref(avctx, &s->ref[i]); > - av_frame_free(&s->ref[i].f); > + if (s->ref[i].f) { Wouldn't it be simpler and more consistent to check for the frame's existence in av1_frame_unref()? > + av1_frame_unref(&s->ref[i]); > + av_frame_free(&s->ref[i].f); > + } > + } > + if (s->cur_frame.f) { > + av1_frame_unref(&s->cur_frame); > + av_frame_free(&s->cur_frame.f); > } > - av1_frame_unref(avctx, &s->cur_frame); > - av_frame_free(&s->cur_frame.f); > - > ff_refstruct_unref(&s->seq_ref); > ff_refstruct_unref(&s->header_ref); > ff_refstruct_unref(&s->cll_ref); LGTM otherwise. -- 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".