From edf9d9f41fae75e84633ad7125a3f6c2cd37f831 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 5 Jan 2015 00:33:18 -0800 Subject: [PATCH] win-capture: Add 'retry_interval' variable Adds a variable 'retry_interval' to game capture that allows the interval at which game capture checks to update to longer intervals if the hook initialization has some sort of failure. The reason why I want to do this is because I don't really like it when the hook updates too often in failure, it just leads to log file spam that I feel can be reduced, and it frequent updates feel a bit invasive. I just generally feel more comfortable reducing the interval at which the hook retries after failure. --- plugins/win-capture/game-capture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/win-capture/game-capture.c b/plugins/win-capture/game-capture.c index 80a08c6ab..6ce3be8c6 100644 --- a/plugins/win-capture/game-capture.c +++ b/plugins/win-capture/game-capture.c @@ -77,6 +77,7 @@ struct game_capture { HWND window; float check_interval; float fps_reset_interval; + float retry_interval; bool active : 1; bool activate_hook : 1; bool process_is_64bit : 1; @@ -320,6 +321,7 @@ static void game_capture_update(void *data, obs_data_t *settings) free_config(&gc->config); gc->config = cfg; gc->activate_hook = obs_data_get_bool(settings, "activate_hook"); + gc->retry_interval = 2.0f; if (!gc->initial_config) { if (reset_capture) { @@ -337,6 +339,7 @@ static void *game_capture_create(obs_data_t *settings, obs_source_t *source) struct game_capture *gc = bzalloc(sizeof(*gc)); gc->source = source; gc->initial_config = true; + gc->retry_interval = 2.0f; game_capture_update(gc, settings); return gc; @@ -951,7 +954,8 @@ static void game_capture_tick(void *data, float seconds) gc->check_interval += seconds; if (!gc->active) { - if (!gc->error_acquiring && gc->check_interval > 2.0f) { + if (!gc->error_acquiring && + gc->check_interval > gc->retry_interval) { if (gc->config.capture_any_fullscreen || gc->activate_hook) { try_hook(gc); @@ -978,7 +982,7 @@ static void game_capture_tick(void *data, float seconds) } gc->fps_reset_interval += seconds; - if (gc->fps_reset_interval >= 2.0f) { + if (gc->fps_reset_interval >= gc->retry_interval) { reset_frame_interval(gc); gc->fps_reset_interval = 0.0f; }