From 4dbb75c437117285cfa195c437a8a1ee898e9293 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 11 Aug 2020 10:55:16 +0200 Subject: [PATCH] avfilter/vf_xfade: check that fps between inputs are valid --- libavfilter/vf_xfade.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c index 6467838ad1..724be2f419 100644 --- a/libavfilter/vf_xfade.c +++ b/libavfilter/vf_xfade.c @@ -1411,6 +1411,22 @@ static int config_output(AVFilterLink *outlink) return AVERROR(EINVAL); } + if (!inlink0->frame_rate.num || !inlink0->frame_rate.den) { + av_log(ctx, AV_LOG_ERROR, "The inputs needs to be a constant frame rate; " + "current rate of %d/%d is invalid\n", inlink0->frame_rate.num, inlink0->frame_rate.den); + return AVERROR(EINVAL); + } + + if (inlink0->frame_rate.num != inlink1->frame_rate.num || + inlink0->frame_rate.den != inlink1->frame_rate.den) { + av_log(ctx, AV_LOG_ERROR, "First input link %s frame rate " + "(%d/%d) do not match the corresponding " + "second input link %s frame rate (%d/%d)\n", + ctx->input_pads[0].name, inlink0->frame_rate.num, inlink0->frame_rate.den, + ctx->input_pads[1].name, inlink1->frame_rate.num, inlink1->frame_rate.den); + return AVERROR(EINVAL); + } + outlink->w = inlink0->w; outlink->h = inlink0->h; outlink->time_base = inlink0->time_base;