avfilter/vf_xfade: fix excessive number of queued frames

Also do not abort in some cases too early when transition is over.

Fixes #8823.
This commit is contained in:
Paul B Mahol 2020-08-30 11:07:51 +02:00
parent 9372eb00c8
commit 60796d22f9
1 changed files with 9 additions and 7 deletions

View File

@ -1779,10 +1779,9 @@ static int xfade_activate(AVFilterContext *ctx)
ff_outlink_set_status(outlink, status, s->pts);
return 0;
} else if (!ret) {
if (ff_outlink_frame_wanted(outlink)) {
if (ff_outlink_frame_wanted(outlink))
ff_inlink_request_frame(ctx->inputs[1]);
return 0;
}
return 0;
}
}
@ -1832,14 +1831,17 @@ static int xfade_activate(AVFilterContext *ctx)
if (!s->eof[1] && ff_outlink_get_status(ctx->inputs[1])) {
s->eof[1] = 1;
}
if (!s->eof[0] && !s->xf[0])
if (!s->eof[0] && !s->xf[0] && ff_inlink_queued_frames(ctx->inputs[0]) == 0)
ff_inlink_request_frame(ctx->inputs[0]);
if (!s->eof[1] && (s->need_second || s->eof[0]))
if (!s->eof[1] && (s->need_second || s->eof[0]) && ff_inlink_queued_frames(ctx->inputs[1]) == 0)
ff_inlink_request_frame(ctx->inputs[1]);
if (s->eof[0] && s->eof[1] && (
ff_inlink_queued_frames(ctx->inputs[0]) <= 0 ||
ff_inlink_queued_frames(ctx->inputs[1]) <= 0))
ff_inlink_queued_frames(ctx->inputs[0]) <= 0 &&
ff_inlink_queued_frames(ctx->inputs[1]) <= 0)) {
ff_outlink_set_status(outlink, AVERROR_EOF, AV_NOPTS_VALUE);
} else if (s->xfade_is_over) {
ff_filter_set_ready(ctx, 100);
}
return 0;
}