From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/pthread_frame: Remove ff_thread_release_buffer()
Date: Fri, 20 Oct 2023 18:59:59 +0200
Message-ID: <169782119949.23937.14840894747163481007@lain.khirnov.net> (raw)
In-Reply-To: <AS8P250MB07446041C6C1CF2D00F29B6B8FDBA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
Quoting Andreas Rheinhardt (2023-10-20 17:41:17)
> Anton Khirnov:
> > 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()?
> >
>
> The frame being NULL is a very exceptional scenario: It can only happen
> if init failed. In this case it is clear that the AV1Frame is blank and
> need not be unreferenced at all. Given that av1_frame_unref() is not
> called infrequently, why should it check all the time for this
> exceptional scenario? It seems better to handle this case in the only
> codepath that needs to handle this.
Ok, as you prefer.
--
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".
next prev parent reply other threads:[~2023-10-20 17:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 14:33 Andreas Rheinhardt
2023-10-20 14:34 ` [FFmpeg-devel] [PATCH 2/2] avcodec/av1dec, vaapi_av1: Remove excessive logmessages Andreas Rheinhardt
2023-10-20 15:23 ` [FFmpeg-devel] [PATCH 1/2] avcodec/pthread_frame: Remove ff_thread_release_buffer() Anton Khirnov
2023-10-20 15:41 ` Andreas Rheinhardt
2023-10-20 16:59 ` Anton Khirnov [this message]
2023-10-21 15:02 ` Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=169782119949.23937.14840894747163481007@lain.khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git