[FFmpeg-devel] [PATCH v1 2/2] avfilter/vf_colorconstancy: av_frame_free(&in) in case of error or direct flag is false
Paul B Mahol
onemda at gmail.com
Wed Nov 27 12:47:54 EET 2019
lgtm
On 11/27/19, lance.lmwang at gmail.com <lance.lmwang at gmail.com> wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavfilter/vf_colorconstancy.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/libavfilter/vf_colorconstancy.c
> b/libavfilter/vf_colorconstancy.c
> index cc081e957f..9917d8993e 100644
> --- a/libavfilter/vf_colorconstancy.c
> +++ b/libavfilter/vf_colorconstancy.c
> @@ -682,13 +682,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
> AVFilterLink *outlink = ctx->outputs[0];
> AVFrame *out;
> int ret;
> + int direct = 0;
>
> ret = illumination_estimation(ctx, in);
> if (ret) {
> + av_frame_free(&in);
> return ret;
> }
>
> if (av_frame_is_writable(in)) {
> + direct = 1;
> out = in;
> } else {
> out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
> @@ -700,6 +703,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
> }
> chromatic_adaptation(ctx, in, out);
>
> + if (!direct)
> + av_frame_free(&in);
> +
> return ff_filter_frame(outlink, out);
> }
>
> --
> 2.21.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list