Commit 87e0247a authored by Marton Balint's avatar Marton Balint

avfilter/f_loop: fix video loop issues with 0 size or when size is bigger than input

Fixes infinte loop with -vf loop=loop=1 and also fixes looping when the input
is less frames than the specified loop size.

Possible regressions since ef1aadff.
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent f811ac52
...@@ -343,7 +343,7 @@ static int activate(AVFilterContext *ctx) ...@@ -343,7 +343,7 @@ static int activate(AVFilterContext *ctx)
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
if (!s->eof && (s->nb_frames < s->size || !s->loop)) { if (!s->eof && (s->nb_frames < s->size || !s->loop || !s->size)) {
ret = ff_inlink_consume_frame(inlink, &frame); ret = ff_inlink_consume_frame(inlink, &frame);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -352,11 +352,13 @@ static int activate(AVFilterContext *ctx) ...@@ -352,11 +352,13 @@ static int activate(AVFilterContext *ctx)
} }
if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) { if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
if (status == AVERROR_EOF) if (status == AVERROR_EOF) {
s->size = s->nb_frames;
s->eof = 1; s->eof = 1;
}
} }
if (s->eof && (s->loop == 0 || s->nb_frames < s->size)) { if (s->eof && (!s->loop || !s->size)) {
ff_outlink_set_status(outlink, AVERROR_EOF, s->duration); ff_outlink_set_status(outlink, AVERROR_EOF, s->duration);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment