Skip to content

Commit 560aaeb

Browse files
committed
obs-browser: Update default size
1 parent 88b670b commit 560aaeb

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

obs-browser-plugin.cpp

+18-2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ static void browser_source_get_defaults(obs_data_t *settings)
131131
obs_data_set_default_bool(settings, "reroute_audio", false);
132132
}
133133

134+
static void browser_source_get_defaults_v2(obs_data_t *settings)
135+
{
136+
browser_source_get_defaults(settings);
137+
138+
struct obs_video_info ovi;
139+
obs_get_video_info(&ovi);
140+
141+
obs_data_set_default_int(settings, "width", ovi.base_width);
142+
obs_data_set_default_int(settings, "height", ovi.base_height);
143+
}
144+
134145
static bool is_local_file_modified(obs_properties_t *props, obs_property_t *,
135146
obs_data_t *settings)
136147
{
@@ -408,7 +419,7 @@ extern "C" EXPORT void obs_browser_initialize(void)
408419
void RegisterBrowserSource()
409420
{
410421
struct obs_source_info info = {};
411-
info.id = "browser_source";
422+
info.id = "browser_source_v2";
412423
info.type = OBS_SOURCE_TYPE_INPUT;
413424
info.output_flags = OBS_SOURCE_VIDEO |
414425
#if CHROME_VERSION_BUILD >= 3683
@@ -417,7 +428,7 @@ void RegisterBrowserSource()
417428
OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION |
418429
OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB;
419430
info.get_properties = browser_source_get_properties;
420-
info.get_defaults = browser_source_get_defaults;
431+
info.get_defaults = browser_source_get_defaults_v2;
421432
info.icon_type = OBS_ICON_TYPE_BROWSER;
422433

423434
info.get_name = [](void *) { return obs_module_text("BrowserSource"); };
@@ -496,6 +507,11 @@ void RegisterBrowserSource()
496507
};
497508

498509
obs_register_source(&info);
510+
511+
info.id = "browser_source";
512+
info.output_flags |= OBS_SOURCE_CAP_OBSOLETE;
513+
info.get_defaults = browser_source_get_defaults;
514+
obs_register_source(&info);
499515
}
500516

501517
/* ========================================================================= */

0 commit comments

Comments
 (0)