From 23e9b57791c6788896b00d8ceadc7cf17153a35d Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 27 Aug 2023 13:51:00 +0200 Subject: [PATCH] vo_gpu_next: don't nuke main options state in video_screenshot This actually fixes a bug that was present in this code even before the new pl_options system, which is that `video_screenshot` would permanently leave `peak_detect_params.allow_delayed` as false, until something else forced options re-application due to options cache change. --- video/out/vo_gpu_next.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index ecb80eeea1..85d38e42c6 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1185,11 +1185,18 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) args->res = NULL; update_options(vo); - pars->params.info_callback = NULL; - pars->params.skip_caching_single_frame = true; - pars->params.preserve_mixing_cache = false; - pars->params.frame_mixer = NULL; - pars->peak_detect_params.allow_delayed = false; + struct pl_render_params params = pars->params; + params.info_callback = NULL; + params.skip_caching_single_frame = true; + params.preserve_mixing_cache = false; + params.frame_mixer = NULL; + + struct pl_peak_detect_params peak_params; + if (params.peak_detect_params) { + peak_params = *params.peak_detect_params; + params.peak_detect_params = &peak_params; + peak_params.allow_delayed = false; + } // Retrieve the current frame from the frame queue struct pl_frame_mix mix; @@ -1290,7 +1297,7 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) &p->osd_state, &target); image.num_overlays = 0; // Disable on-screen overlays - if (!pl_render_image(p->rr, &image, &target, &pars->params)) { + if (!pl_render_image(p->rr, &image, &target, ¶ms)) { MP_ERR(vo, "Failed rendering frame!\n"); goto done; }