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 189E240295 for ; Wed, 19 Jan 2022 13:48:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4E85168B0B2; Wed, 19 Jan 2022 15:48:00 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1A22568B092 for ; Wed, 19 Jan 2022 15:47:54 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 7A85324017C for ; Wed, 19 Jan 2022 14:47:53 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id motVZthWnwJg for ; Wed, 19 Jan 2022 14:47:52 +0100 (CET) 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 DF397240179 for ; Wed, 19 Jan 2022 14:47:52 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id D28A716008E; Wed, 19 Jan 2022 14:47:52 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <51796511-a27c-3318-9d97-bb8ce4c972a0@gmail.com> References: <20220119134040.774-1-anton@khirnov.net> <20220119134040.774-3-anton@khirnov.net> <51796511-a27c-3318-9d97-bb8ce4c972a0@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Wed, 19 Jan 2022 14:47:52 +0100 Message-ID: <164260007274.20480.15161777750797248029@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavu/hwcontext: clarify behavior on av_hwframe_map() failure 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 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".