From: Niklas Haas <ffmpeg@haasn.xyz> To: ffmpeg-devel@ffmpeg.org Cc: Niklas Haas <git@haasn.dev> Subject: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_scale: test return code of scale_frame() Date: Tue, 9 Jul 2024 11:34:37 +0200 Message-ID: <20240709093437.16563-2-ffmpeg@haasn.xyz> (raw) In-Reply-To: <20240709093437.16563-1-ffmpeg@haasn.xyz> From: Niklas Haas <git@haasn.dev> Instead of testing the returned frame against NULL, test the return code itself, going more in line with the usual behavior of such functions. --- libavfilter/vf_scale.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index a1a322ed9e..ae7356fd7b 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -883,7 +883,6 @@ static int scale_frame(AVFilterLink *link, AVFrame **frame_in, int frame_changed; *frame_in = NULL; - *frame_out = NULL; if (in->colorspace == AVCOL_SPC_YCGCO) av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n"); @@ -1064,14 +1063,15 @@ FF_ENABLE_DEPRECATION_WARNINGS } ret = scale_frame(ctx->inputs[0], &in, &out); - if (out) { - out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); - return ff_filter_frame(outlink, out); - } + if (ret < 0) + goto err; + + av_assert0(out); + out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base); + return ff_filter_frame(outlink, out); err: - if (ret < 0) - av_frame_free(&in); + av_frame_free(&in); return ret; } -- 2.44.0 _______________________________________________ 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:[~2024-07-09 9:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-07-09 9:34 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_scale: fix frame lifetimes Niklas Haas 2024-07-09 9:34 ` Niklas Haas [this message] 2024-07-10 9:03 ` Anton Khirnov 2024-07-10 12:29 ` Michael Niedermayer
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=20240709093437.16563-2-ffmpeg@haasn.xyz \ --to=ffmpeg@haasn.xyz \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=git@haasn.dev \ /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