0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00

win-capture: Faster display / window capture updates

When changing the target for display or window capture, force a
refresh of the source by setting the timer to fire immediately. This
removes 1-3 seconds of "lag" before the new display or window is
visible and makes the UI feel more responsive.

Closes https://github.com/obsproject/obs-studio/issues/2322
This commit is contained in:
Richard Stanway 2020-02-03 23:22:42 +01:00
parent 86d3eb3088
commit fb6936a934
2 changed files with 5 additions and 2 deletions

View File

@ -58,7 +58,7 @@ static inline void update_settings(struct duplicator_capture *capture,
capture->x = 0;
capture->y = 0;
capture->rot = 0;
capture->reset_timeout = 0.0f;
capture->reset_timeout = RESET_INTERVAL_SEC;
obs_leave_graphics();
}

View File

@ -16,6 +16,8 @@
/* clang-format on */
#define WC_CHECK_TIMER 1.0f
struct window_capture {
obs_source_t *source;
@ -103,6 +105,7 @@ static void wc_update(void *data, obs_data_t *settings)
/* forces a reset */
wc->window = NULL;
wc->check_window_timer = WC_CHECK_TIMER;
}
static uint32_t wc_width(void *data)
@ -166,7 +169,7 @@ static void wc_tick(void *data, float seconds)
wc->check_window_timer += seconds;
if (wc->check_window_timer < 1.0f) {
if (wc->check_window_timer < WC_CHECK_TIMER) {
if (wc->capture.valid)
dc_capture_free(&wc->capture);
return;