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 767A6455B2 for ; Mon, 6 Feb 2023 14:26:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C7BBA68BE59; Mon, 6 Feb 2023 16:26:41 +0200 (EET) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE0F268B213 for ; Mon, 6 Feb 2023 16:26:34 +0200 (EET) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 316EQXB5019212 for ; Mon, 6 Feb 2023 15:26:33 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id 6F1A0EB5BC; Mon, 6 Feb 2023 15:26:33 +0100 (CET) Date: Mon, 6 Feb 2023 15:26:33 +0100 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Mon, 06 Feb 2023 15:26:33 +0100 (CET) Subject: Re: [FFmpeg-devel] [PATCH] avfilter: use ff_inlink_make_frame_writable() 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: Paul B Mahol (12023-02-06): > Patch attached. > From 8d2d4d35a54d0a3ddf300ef7196489898c3efc4e Mon Sep 17 00:00:00 2001 > From: Paul B Mahol > Date: Mon, 6 Feb 2023 14:57:50 +0100 > Subject: [PATCH] avfilter: use ff_inlink_make_frame_writable() > > Signed-off-by: Paul B Mahol > --- > libavfilter/avf_abitscope.c | 11 +++++++++-- > libavfilter/avf_ahistogram.c | 9 +++++++-- > libavfilter/avf_aphasemeter.c | 9 +++++++-- > libavfilter/avf_avectorscope.c | 7 ++++++- > libavfilter/avf_showspectrum.c | 5 ++++- > libavfilter/avf_showvolume.c | 6 ++++-- > libavfilter/f_ebur128.c | 10 ++++++++-- > libavfilter/f_perms.c | 3 ++- > libavfilter/framesync.c | 2 +- > libavfilter/vf_cover_rect.c | 7 +++++-- > libavfilter/vf_dedot.c | 2 +- > libavfilter/vf_floodfill.c | 3 ++- > libavfilter/vf_lensfun.c | 6 +++++- > libavfilter/vf_overlay_cuda.c | 3 ++- > libavfilter/vf_paletteuse.c | 2 +- > libavfilter/vf_photosensitivity.c | 3 ++- > libavfilter/vf_repeatfields.c | 13 ++++++++++--- > libavfilter/vf_signalstats.c | 13 +++++++++---- > libavfilter/vf_telecine.c | 13 +++++++++++-- > libavfilter/vf_vidstabdetect.c | 10 +++++++--- > 20 files changed, 103 insertions(+), 34 deletions(-) > > diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c > index 4fc3c06ecb..782d57e03a 100644 > --- a/libavfilter/avf_abitscope.c > +++ b/libavfilter/avf_abitscope.c > @@ -213,6 +213,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > AVFilterLink *outlink = ctx->outputs[0]; > AudioBitScopeContext *s = ctx->priv; > AVFrame *outpicref; > + int ret; > > if (s->mode == 0 || !s->outpicref) { > outpicref = ff_get_video_buffer(outlink, outlink->w, outlink->h); > @@ -228,10 +229,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > } > > if (s->mode == 1) { > - av_frame_make_writable(s->outpicref); > + ret = ff_inlink_make_frame_writable(outlink, &s->outpicref); > + if (ret < 0) { > + av_frame_free(&insamples); > + return ret; > + } > outpicref = av_frame_clone(s->outpicref); > - if (!outpicref) > + if (!outpicref) { > + av_frame_free(&insamples); > return AVERROR(ENOMEM); > + } > } > > outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); > diff --git a/libavfilter/avf_ahistogram.c b/libavfilter/avf_ahistogram.c > index c45493730d..06490192a5 100644 > --- a/libavfilter/avf_ahistogram.c > +++ b/libavfilter/avf_ahistogram.c > @@ -209,7 +209,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > AudioHistogramContext *s = ctx->priv; > const int H = s->histogram_h; > const int w = s->w; > - int c, y, n, p, bin; > + int c, y, n, p, bin, ret; > uint64_t acmax = 1; > AVFrame *clone; > > @@ -229,7 +229,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > } > } > > - av_frame_make_writable(s->out); > + ret = ff_inlink_make_frame_writable(outlink, &s->out); > + if (ret < 0) { > + av_frame_free(&in); > + return ret; > + } > + > if (s->dmode == SEPARATE) { > for (y = 0; y < w; y++) { > s->combine_buffer[3 * y ] = 0; > diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c > index 0f7692982c..bf9f922639 100644 > --- a/libavfilter/avf_aphasemeter.c > +++ b/libavfilter/avf_aphasemeter.c > @@ -29,6 +29,7 @@ > #include "libavutil/parseutils.h" > #include "libavutil/timestamp.h" > #include "avfilter.h" > +#include "filters.h" > #include "formats.h" > #include "audio.h" > #include "video.h" > @@ -246,7 +247,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > float fphase = 0; > AVFrame *out; > uint8_t *dst; > - int i; > + int i, ret; > int mono_measurement; > int out_phase_measurement; > float tolerance = 1.0f - s->tolerance; > @@ -265,8 +266,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > for (i = 0; i < outlink->h; i++) > memset(out->data[0] + i * out->linesize[0], 0, outlink->w * 4); > } else if (s->do_video) { > + ret = ff_inlink_make_frame_writable(outlink, &s->out); > + if (ret < 0) { > + av_frame_free(&in); > + return ret; > + } > out = s->out; > - av_frame_make_writable(s->out); > for (i = outlink->h - 1; i >= 10; i--) > memmove(out->data[0] + (i ) * out->linesize[0], > out->data[0] + (i-1) * out->linesize[0], > diff --git a/libavfilter/avf_avectorscope.c b/libavfilter/avf_avectorscope.c > index 3927d80b42..6e45fd9575 100644 > --- a/libavfilter/avf_avectorscope.c > +++ b/libavfilter/avf_avectorscope.c > @@ -297,6 +297,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > unsigned x, y; > unsigned prev_x = s->prev_x, prev_y = s->prev_y; > double zoom = s->zoom; > + int ret; > > if (!s->outpicref || s->outpicref->width != outlink->w || > s->outpicref->height != outlink->h) { > @@ -314,7 +315,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > s->outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); > s->outpicref->duration = 1; > > - av_frame_make_writable(s->outpicref); > + ret = ff_inlink_make_frame_writable(outlink, &s->outpicref); > + if (ret < 0) { > + av_frame_free(&insamples); > + return ret; > + } > ff_filter_execute(ctx, fade, NULL, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); > > if (zoom < 1) { > diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c > index 24a424a34a..4ce964706f 100644 > --- a/libavfilter/avf_showspectrum.c > +++ b/libavfilter/avf_showspectrum.c > @@ -1441,7 +1441,10 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) > } > } > > - av_frame_make_writable(s->outpicref); > + ret = ff_inlink_make_frame_writable(outlink, &s->outpicref); > + if (ret < 0) > + return ret; > + outpicref = s->outpicref; > /* copy to output */ > if (s->orientation == VERTICAL) { > if (s->sliding == SCROLL) { > diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c > index 24d42d030d..645fc68cb0 100644 > --- a/libavfilter/avf_showvolume.c > +++ b/libavfilter/avf_showvolume.c > @@ -324,7 +324,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > AVFilterLink *outlink = ctx->outputs[0]; > ShowVolumeContext *s = ctx->priv; > const int step = s->step; > - int c, j, k, max_draw; > + int c, j, k, max_draw, ret; > char channel_name[64]; > AVFrame *out; > > @@ -434,7 +434,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > out = av_frame_clone(s->out); > if (!out) > return AVERROR(ENOMEM); > - av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(outlink, &out); > + if (ret < 0) > + return ret; Possible leak? > > /* draw volume level */ > for (c = 0; c < inlink->ch_layout.nb_channels && s->h >= 8 && s->draw_volume; c++) { > diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c > index 8afab37fdb..ef0fb4a52a 100644 > --- a/libavfilter/f_ebur128.c > +++ b/libavfilter/f_ebur128.c > @@ -618,7 +618,7 @@ static int gate_update(struct integrator *integ, double power, > > static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > { > - int i, ch, idx_insample; > + int i, ch, idx_insample, ret; > AVFilterContext *ctx = inlink->dst; > EBUR128Context *ebur128 = ctx->priv; > const int nb_channels = ebur128->nb_channels; > @@ -821,7 +821,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) > y_loudness_lu_graph = lu_to_y(ebur128, loudness_3000 - ebur128->target); > y_loudness_lu_gauge = lu_to_y(ebur128, gauge_value); > > - av_frame_make_writable(pic); > + ret = ff_inlink_make_frame_writable(outlink, &ebur128->outpicref); > + if (ret < 0) { > + av_frame_free(&insamples); > + ebur128->insamples = NULL; > + return ret; > + } > + pic = ebur128->outpicref; > /* draw the graph using the short-term loudness */ > p = pic->data[0] + ebur128->graph.y*pic->linesize[0] + ebur128->graph.x*3; > for (y = 0; y < ebur128->graph.h; y++) { > diff --git a/libavfilter/f_perms.c b/libavfilter/f_perms.c > index e26a15fd06..95fb97f201 100644 > --- a/libavfilter/f_perms.c > +++ b/libavfilter/f_perms.c > @@ -24,6 +24,7 @@ > #include "libavutil/opt.h" > #include "libavutil/random_seed.h" > #include "audio.h" > +#include "filters.h" > #include "video.h" > > enum mode { > @@ -96,7 +97,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) > in_perm == out_perm ? " (no-op)" : ""); > > if (in_perm == RO && out_perm == RW) { > - if ((ret = av_frame_make_writable(frame)) < 0) > + if ((ret = ff_inlink_make_frame_writable(inlink, &frame)) < 0) > return ret; > } else if (in_perm == RW && out_perm == RO) { > out = av_frame_clone(frame); > diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c > index ee91e4cf68..422f4f7ad1 100644 > --- a/libavfilter/framesync.c > +++ b/libavfilter/framesync.c > @@ -288,7 +288,7 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, > if (need_copy) { > if (!(frame = av_frame_clone(frame))) > return AVERROR(ENOMEM); > - if ((ret = av_frame_make_writable(frame)) < 0) { > + if ((ret = ff_inlink_make_frame_writable(fs->parent->inputs[0], &frame) < 0)) { > av_frame_free(&frame); > return ret; > } > diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c > index 01c9f2abbb..2fc5fc9693 100644 > --- a/libavfilter/vf_cover_rect.c > +++ b/libavfilter/vf_cover_rect.c > @@ -24,6 +24,7 @@ > > #include "libavutil/imgutils.h" > #include "libavutil/opt.h" > +#include "filters.h" > #include "internal.h" > > #include "lavfutils.h" > @@ -125,7 +126,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > AVFilterContext *ctx = inlink->dst; > CoverContext *cover = ctx->priv; > AVDictionaryEntry *ex, *ey, *ew, *eh; > - int x = -1, y = -1, w = -1, h = -1; > + int ret, x = -1, y = -1, w = -1, h = -1; > char *xendptr = NULL, *yendptr = NULL, *wendptr = NULL, *hendptr = NULL; > > ex = av_dict_get(in->metadata, "lavfi.rect.x", NULL, AV_DICT_MATCH_CASE); > @@ -170,7 +171,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > x = av_clip(x, 0, in->width - w); > y = av_clip(y, 0, in->height - h); > > - av_frame_make_writable(in); > + ret = ff_inlink_make_frame_writable(inlink, &in); > + if (ret < 0) > + return ret; Ditto? > > if (cover->mode == MODE_BLUR) { > blur (cover, in, x, y); > diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c > index a0638f45b4..6ca47c262a 100644 > --- a/libavfilter/vf_dedot.c > +++ b/libavfilter/vf_dedot.c > @@ -289,7 +289,7 @@ static int activate(AVFilterContext *ctx) > s->frames[4]) { > out = av_frame_clone(s->frames[2]); > if (out && !ctx->is_disabled) { > - ret = av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(inlink, &out); > if (ret >= 0) { > if (s->m & 1) > ff_filter_execute(ctx, s->dedotcrawl, out, NULL, > diff --git a/libavfilter/vf_floodfill.c b/libavfilter/vf_floodfill.c > index da747c9f9f..952f1d15f1 100644 > --- a/libavfilter/vf_floodfill.c > +++ b/libavfilter/vf_floodfill.c > @@ -22,6 +22,7 @@ > #include "libavutil/imgutils.h" > #include "libavutil/intreadwrite.h" > #include "avfilter.h" > +#include "filters.h" > #include "formats.h" > #include "internal.h" > #include "video.h" > @@ -315,7 +316,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) > s->front++; > } > > - if (ret = av_frame_make_writable(frame)) > + if (ret = ff_inlink_make_frame_writable(link, &frame)) > return ret; > > while (s->front > s->back) { > diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c > index 35c522a723..52652e0c9b 100644 > --- a/libavfilter/vf_lensfun.c > +++ b/libavfilter/vf_lensfun.c > @@ -32,6 +32,7 @@ > #include "libavutil/opt.h" > #include "libswscale/swscale.h" > #include "avfilter.h" > +#include "filters.h" > #include "formats.h" > #include "internal.h" > #include "video.h" > @@ -443,9 +444,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > AVFrame *out; > VignettingThreadData vignetting_thread_data; > DistortionCorrectionThreadData distortion_correction_thread_data; > + int ret; > > if (lensfun->mode & VIGNETTING) { > - av_frame_make_writable(in); > + ret = ff_inlink_make_frame_writable(inlink, &in); > + if (ret < 0) > + return ret; Ditto? > > vignetting_thread_data = (VignettingThreadData) { > .width = inlink->w, > diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c > index 68c00405fb..b2cbb9c625 100644 > --- a/libavfilter/vf_overlay_cuda.c > +++ b/libavfilter/vf_overlay_cuda.c > @@ -32,6 +32,7 @@ > #include "libavutil/eval.h" > > #include "avfilter.h" > +#include "filters.h" > #include "framesync.h" > #include "internal.h" > > @@ -252,7 +253,7 @@ static int overlay_cuda_blend(FFFrameSync *fs) > if (!input_overlay) > return ff_filter_frame(outlink, input_main); > > - ret = av_frame_make_writable(input_main); > + ret = ff_inlink_make_frame_writable(inlink, &input_main); > if (ret < 0) { > av_frame_free(&input_main); > return ret; > diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c > index 944ff5c74d..5fa7a605ce 100644 > --- a/libavfilter/vf_paletteuse.c > +++ b/libavfilter/vf_paletteuse.c > @@ -783,7 +783,7 @@ static int apply_palette(AVFilterLink *inlink, AVFrame *in, AVFrame **outf) > av_frame_unref(s->last_out); > if ((ret = av_frame_ref(s->last_in, in)) < 0 || > (ret = av_frame_ref(s->last_out, out)) < 0 || > - (ret = av_frame_make_writable(s->last_in)) < 0) { > + (ret = ff_inlink_make_frame_writable(inlink, &s->last_in)) < 0) { > av_frame_free(&out); > *outf = NULL; > return ret; > diff --git a/libavfilter/vf_photosensitivity.c b/libavfilter/vf_photosensitivity.c > index 1bb984cc93..e05d4d0262 100644 > --- a/libavfilter/vf_photosensitivity.c > +++ b/libavfilter/vf_photosensitivity.c > @@ -25,6 +25,7 @@ > #include "libavutil/pixdesc.h" > #include "avfilter.h" > > +#include "filters.h" > #include "formats.h" > #include "internal.h" > #include "video.h" > @@ -243,7 +244,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > /* just duplicate the frame */ > s->history[s->history_pos] = 0; /* frame was duplicated, thus, delta is zero */ > } else { > - res = av_frame_make_writable(s->last_frame_av); > + res = ff_inlink_make_frame_writable(inlink, &s->last_frame_av); > if (res) { > av_frame_free(&in); > return res; > diff --git a/libavfilter/vf_repeatfields.c b/libavfilter/vf_repeatfields.c > index 9c02c61631..4ace5a18f7 100644 > --- a/libavfilter/vf_repeatfields.c > +++ b/libavfilter/vf_repeatfields.c > @@ -20,6 +20,7 @@ > > #include "libavutil/imgutils.h" > #include "avfilter.h" > +#include "filters.h" > #include "internal.h" > > typedef struct RepeatFieldsContext { > @@ -110,7 +111,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) { > ret = ff_filter_frame(outlink, new); > > if (in->repeat_pict) { > - av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(inlink, &out); > + if (ret < 0) > + return ret; Ditto? > update_pts(outlink, out, in->pts, 2); > for (i = 0; i < s->nb_planes; i++) { > av_image_copy_plane(out->data[i], out->linesize[i] * 2, > @@ -121,7 +124,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) { > } > } else { > for (i = 0; i < s->nb_planes; i++) { > - av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(inlink, &out); > + if (ret < 0) > + return ret; Ditto? > av_image_copy_plane(out->data[i] + out->linesize[i], out->linesize[i] * 2, > in->data[i] + in->linesize[i], in->linesize[i] * 2, > s->linesize[i], s->planeheight[i] / 2); > @@ -139,7 +144,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) { > ret = ff_filter_frame(outlink, new); > state = 0; > } else { > - av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(inlink, &out); > + if (ret < 0) > + return ret; Ditto? > update_pts(outlink, out, in->pts, 1); > for (i = 0; i < s->nb_planes; i++) { > av_image_copy_plane(out->data[i], out->linesize[i] * 2, > diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c > index e6f84be9ba..93ff378b31 100644 > --- a/libavfilter/vf_signalstats.c > +++ b/libavfilter/vf_signalstats.c > @@ -23,6 +23,7 @@ > #include "libavutil/intreadwrite.h" > #include "libavutil/opt.h" > #include "libavutil/pixdesc.h" > +#include "filters.h" > #include "internal.h" > > enum FilterMode { > @@ -565,7 +566,7 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) > int tothue = 0; > int dify = 0, difu = 0, difv = 0; > uint16_t masky = 0, masku = 0, maskv = 0; > - > + int ret; > int filtot[FILT_NUMB] = {0}; > AVFrame *prev; > > @@ -588,7 +589,9 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) > > if (s->outfilter != FILTER_NONE) { > out = av_frame_clone(in); > - av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(link, &out); > + if (ret < 0) > + return ret; Ditto? > } > > ff_filter_execute(ctx, compute_sat_hue_metrics8, &td_huesat, > @@ -790,7 +793,7 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) > > int filtot[FILT_NUMB] = {0}; > AVFrame *prev; > - > + int ret; > AVFrame *sat = s->frame_sat; > AVFrame *hue = s->frame_hue; > const uint16_t *p_sat = (uint16_t *)sat->data[0]; > @@ -810,7 +813,9 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) > > if (s->outfilter != FILTER_NONE) { > out = av_frame_clone(in); > - av_frame_make_writable(out); > + ret = ff_inlink_make_frame_writable(link, &out); > + if (ret < 0) > + return ret; Ditto? > } > > ff_filter_execute(ctx, compute_sat_hue_metrics16, &td_huesat, > diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c > index e8de63bbcf..227de6f733 100644 > --- a/libavfilter/vf_telecine.c > +++ b/libavfilter/vf_telecine.c > @@ -29,6 +29,7 @@ > #include "libavutil/opt.h" > #include "libavutil/pixdesc.h" > #include "avfilter.h" > +#include "filters.h" > #include "formats.h" > #include "internal.h" > #include "video.h" > @@ -182,7 +183,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) > } > > if (s->occupied) { > - av_frame_make_writable(s->frame[nout]); > + ret = ff_inlink_make_frame_writable(inlink, &s->frame[nout]); > + if (ret < 0) { > + av_frame_free(&inpicref); > + return ret; > + } > for (i = 0; i < s->nb_planes; i++) { > // fill in the EARLIER field from the buffered pic > av_image_copy_plane(s->frame[nout]->data[i] + s->frame[nout]->linesize[i] * s->first_field, > @@ -208,7 +213,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) > > while (len >= 2) { > // output THIS image as-is > - av_frame_make_writable(s->frame[nout]); > + ret = ff_inlink_make_frame_writable(inlink, &s->frame[nout]); > + if (ret < 0) { > + av_frame_free(&inpicref); > + return ret; > + } > for (i = 0; i < s->nb_planes; i++) > av_image_copy_plane(s->frame[nout]->data[i], s->frame[nout]->linesize[i], > inpicref->data[i], inpicref->linesize[i], > diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c > index 62b998e171..3eb1abab46 100644 > --- a/libavfilter/vf_vidstabdetect.c > +++ b/libavfilter/vf_vidstabdetect.c > @@ -27,6 +27,7 @@ > #include "libavutil/opt.h" > #include "libavutil/pixdesc.h" > #include "avfilter.h" > +#include "filters.h" > #include "internal.h" > > #include "vidstabutils.h" > @@ -149,10 +150,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > > AVFilterLink *outlink = inlink->dst->outputs[0]; > VSFrame frame; > - int plane; > + int plane, ret; > > - if (s->conf.show > 0 && !av_frame_is_writable(in)) > - av_frame_make_writable(in); > + if (s->conf.show > 0 && !av_frame_is_writable(in)) { > + ret = ff_inlink_make_frame_writable(inlink, &in); > + if (ret < 0) > + return ret; > + } > > for (plane = 0; plane < md->fi.planes; plane++) { > frame.data[plane] = in->data[plane]; No objections except for the possible leaks. -- Nicolas George _______________________________________________ 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".