From 6627c8ea4b4e4e0f9312d3243c099eb5df1a89e7 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 7 Aug 2025 21:51:40 +0200 Subject: [PATCH] avfilter/vf_libplacebo: skip empty inputs It is possible for pl_queue_update() to return PL_QUEUE_OK, but to generate an empty frame mix. This happens if the first frame of that input is in the future. In this case, we should skip an input as not active, similar to inputs that have already reached EOF. --- libavfilter/vf_libplacebo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 7e30524455..caeebc25be 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -1017,7 +1017,7 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) FilterLink *il = ff_filter_link(ctx->inputs[i]); FilterLink *ol = ff_filter_link(outlink); int high_fps = av_cmp_q(il->frame_rate, ol->frame_rate) >= 0; - if (in->qstatus != PL_QUEUE_OK) + if (in->qstatus != PL_QUEUE_OK || !in->mix.num_frames) continue; opts->params.skip_caching_single_frame = high_fps; update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base)); @@ -1205,7 +1205,7 @@ static int libplacebo_activate(AVFilterContext *ctx) retry = true; break; case PL_QUEUE_OK: - ok = true; + ok |= in->mix.num_frames > 0; break; case PL_QUEUE_ERR: return AVERROR_EXTERNAL;