From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavu/hwcontext: clarify behavior on av_hwframe_map() failure
Date: Wed, 19 Jan 2022 14:47:52 +0100
Message-ID: <164260007274.20480.15161777750797248029@lain.red.khirnov.net> (raw)
In-Reply-To: <51796511-a27c-3318-9d97-bb8ce4c972a0@gmail.com>
Quoting James Almer (2022-01-19 14:45:12)
>
>
> On 1/19/2022 10:40 AM, Anton Khirnov wrote:
> > Clear anything that av_hwframe_map() might have done to the destination
> > frame, but leave caller-provided fields unchanged.
> > ---
> > libavutil/hwcontext.c | 23 +++++++++++++++++++++--
> > libavutil/hwcontext.h | 4 ++++
> > 2 files changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
> > index 31c7840dba..ae33da1262 100644
> > --- a/libavutil/hwcontext.c
> > +++ b/libavutil/hwcontext.c
> > @@ -18,6 +18,7 @@
> >
> > #include "config.h"
> >
> > +#include "avassert.h"
> > #include "buffer.h"
> > #include "common.h"
> > #include "hwcontext.h"
> > @@ -788,6 +789,8 @@ fail:
> >
> > int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags)
> > {
> > + AVBufferRef *orig_dst_frames = dst->hw_frames_ctx;
> > + enum AVPixelFormat orig_dst_fmt = dst->format;
> > AVHWFramesContext *src_frames, *dst_frames;
> > HWMapDescriptor *hwmap;
> > int ret;
> > @@ -825,7 +828,7 @@ int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags)
> > ret = src_frames->internal->hw_type->map_from(src_frames,
> > dst, src, flags);
> > if (ret != AVERROR(ENOSYS))
> > - return ret;
> > + goto fail;
>
> What if ret is 0? Is the stuff in the fail label meant to run on success?
Critical brain failure. Will fix.
--
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:[~2022-01-19 13:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 13:40 [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_opencl: clear dangling pointers on map failure Anton Khirnov
2022-01-19 13:40 ` [FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_vulkan: " Anton Khirnov
2022-01-19 13:40 ` [FFmpeg-devel] [PATCH 3/3] lavu/hwcontext: clarify behavior on av_hwframe_map() failure Anton Khirnov
2022-01-19 13:45 ` James Almer
2022-01-19 13:47 ` Anton Khirnov [this message]
2022-01-19 14:01 ` [FFmpeg-devel] [PATCH] " Anton Khirnov
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=164260007274.20480.15161777750797248029@lain.red.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