Skip to content

Commit 22949bc

Browse files
committed
obs-browser: Update default size
1 parent b854309 commit 22949bc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Diff for: obs-browser-plugin.cpp

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

136+
static void browser_source_get_defaults_v2(obs_data_t *settings)
137+
{
138+
browser_source_get_defaults(settings);
139+
140+
struct obs_video_info ovi;
141+
obs_get_video_info(&ovi);
142+
143+
obs_data_set_default_int(settings, "width", ovi.base_width);
144+
obs_data_set_default_int(settings, "height", ovi.base_height);
145+
}
146+
136147
static bool is_local_file_modified(obs_properties_t *props, obs_property_t *,
137148
obs_data_t *settings)
138149
{
@@ -434,7 +445,7 @@ extern "C" EXPORT void obs_browser_initialize(void)
434445
void RegisterBrowserSource()
435446
{
436447
struct obs_source_info info = {};
437-
info.id = "browser_source";
448+
info.id = "browser_source_v2";
438449
info.type = OBS_SOURCE_TYPE_INPUT;
439450
info.output_flags = OBS_SOURCE_VIDEO |
440451
#if CHROME_VERSION_BUILD >= 3683
@@ -443,7 +454,7 @@ void RegisterBrowserSource()
443454
OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION |
444455
OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB;
445456
info.get_properties = browser_source_get_properties;
446-
info.get_defaults = browser_source_get_defaults;
457+
info.get_defaults = browser_source_get_defaults_v2;
447458
info.icon_type = OBS_ICON_TYPE_BROWSER;
448459

449460
info.get_name = [](void *) { return obs_module_text("BrowserSource"); };
@@ -522,6 +533,11 @@ void RegisterBrowserSource()
522533
};
523534

524535
obs_register_source(&info);
536+
537+
info.id = "browser_source";
538+
info.output_flags |= OBS_SOURCE_CAP_OBSOLETE;
539+
info.get_defaults = browser_source_get_defaults;
540+
obs_register_source(&info);
525541
}
526542

527543
/* ========================================================================= */

0 commit comments

Comments
 (0)