aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_scale.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-05-23 16:06:55 +0200
committerAnton Khirnov <anton@khirnov.net>2021-07-12 12:49:25 +0200
commita948e47960fb16819af16d0542a203c59d8de157 (patch)
treecd6451f910e700e82d2f3a65c2de904f0a9f4aa6 /libavfilter/vf_scale.c
parent6d51d65fb99d2dd02cb5589226641f4cb75752db (diff)
downloadffmpeg-a948e47960fb16819af16d0542a203c59d8de157.tar.gz
lavfi/vf_scale: forward errors from swscale
Diffstat (limited to 'libavfilter/vf_scale.c')
-rw-r--r--libavfilter/vf_scale.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 72b49e8918..71d7fa2890 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -655,6 +655,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
AVFrame *out;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
char buf[32];
+ int ret;
int in_range;
int frame_changed;
@@ -669,7 +670,6 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num;
if (scale->eval_mode == EVAL_MODE_FRAME || frame_changed) {
- int ret;
unsigned vars_w[VARS_NB] = { 0 }, vars_h[VARS_NB] = { 0 };
av_expr_count_vars(scale->w_pexpr, vars_w, VARS_NB);
@@ -791,8 +791,9 @@ scale:
INT_MAX);
if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) {
- scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
- scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1);
+ ret = scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
+ if (ret >= 0)
+ ret = scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1);
} else if (scale->nb_slices) {
int i, slice_h, slice_start, slice_end = 0;
const int nb_slices = FFMIN(scale->nb_slices, link->h);
@@ -800,14 +801,18 @@ scale:
slice_start = slice_end;
slice_end = (link->h * (i+1)) / nb_slices;
slice_h = slice_end - slice_start;
- scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0);
+ ret = scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0);
+ if (ret < 0)
+ break;
}
} else {
- scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0);
+ ret = scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0);
}
av_frame_free(&in);
- return 0;
+ if (ret < 0)
+ av_frame_free(frame_out);
+ return ret;
}
static int filter_frame(AVFilterLink *link, AVFrame *in)