aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2025-08-07 22:07:32 +0200
committerNiklas Haas <ffmpeg@haasn.dev>2025-08-08 11:29:27 +0000
commit62893fb94ec19583daf0d6cd65bb6e392fb416cb (patch)
treed96e97f9638c4acc55b3d2ee2b5d2f23cf94335b
parent3091bca3edb339a4d2ec8c64e52fa7e67a7d5005 (diff)
downloadffmpeg-62893fb94ec19583daf0d6cd65bb6e392fb416cb.tar.gz
avfilter/vf_libplacebo: flush render cache when input is invisible
This prevents leaking stale metadata from previous frames, for example if an overlay temporarily obscures this input and then un-obscures it again. It is worth pointing out that this does change the semantics subtly, because of the smoothing period on detected HDR metadata, but I argue that the new behavior is an improvement, as it will avoid leaking past metadata that is definitely no longer relevant after an image is unobscured.
-rw-r--r--libavfilter/vf_libplacebo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index e62114199b..d15c89b51e 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1049,8 +1049,10 @@ 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 || !in->mix.num_frames || i < idx_start)
+ if (in->qstatus != PL_QUEUE_OK || !in->mix.num_frames || i < idx_start) {
+ pl_renderer_flush_cache(in->renderer);
continue;
+ }
opts->params.skip_caching_single_frame = high_fps;
update_crops(ctx, in, &target, target_pts);
pl_render_image_mix(in->renderer, &in->mix, &target, &opts->params);