From d67152bc61073ed7a3f06986cb7c0170ddcc24f3 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Wed, 9 Oct 2019 23:21:44 -0400 Subject: [PATCH] Use OBS canvas size as browser source default size This is a minor QoL change to make browser sources default to be the same size as the user's OBS canvas. For users using overlays, this should reduce the work required to add a browser source for an overlay. For all other use cases, this should not create extra work. --- obs-browser-plugin.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp index c5743de9e..3c76052ef 100644 --- a/obs-browser-plugin.cpp +++ b/obs-browser-plugin.cpp @@ -110,10 +110,15 @@ overflow: hidden; \ static void browser_source_get_defaults(obs_data_t *settings) { + struct obs_video_info ovi = {0}; + obs_get_video_info(&ovi); + int width = ovi.base_width ? ovi.base_width : 800; + int height = ovi.base_height ? ovi.base_height : 600; + obs_data_set_default_string(settings, "url", "https://obsproject.com/browser-source"); - obs_data_set_default_int(settings, "width", 800); - obs_data_set_default_int(settings, "height", 600); + obs_data_set_default_int(settings, "width", width); + obs_data_set_default_int(settings, "height", height); obs_data_set_default_int(settings, "fps", 30); #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED obs_data_set_default_bool(settings, "fps_custom", false);