-
Notifications
You must be signed in to change notification settings - Fork 244
obs-browser: Groundwork to enable Chrome 4430/arm64/Apple silicon #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,7 @@ static int adapterCount = 0; | |
| static std::wstring deviceId; | ||
|
|
||
| bool hwaccel = false; | ||
| bool gpuCompositing = true; | ||
|
|
||
| /* ========================================================================= */ | ||
|
|
||
|
|
@@ -298,7 +299,7 @@ static void BrowserInit(void) | |
| prod_ver << std::to_string(obs_maj) << "." << std::to_string(obs_min) | ||
| << "." << std::to_string(obs_pat); | ||
|
|
||
| #if CHROME_VERSION_BUILD >= 4472 | ||
| #if CHROME_VERSION_BUILD >= 4430 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this is correcting a mistake in #297. According to the linked CEF commit, this is the correct version. I'd prefer this change as its own commit because "Add support for CEF 4430" only barely applies to this change, and I was staring at this change for far too long wondering why it was being changed and what it had to do with adding support for CEF 4430. Honestly, this could even be PR'd and merged separately, because it's a straightforward and simple fix for a mistake that can be merged separately from this. |
||
| CefString(&settings.user_agent_product) = prod_ver.str(); | ||
| #else | ||
| CefString(&settings.product_version) = prod_ver.str(); | ||
|
|
@@ -350,7 +351,7 @@ static void BrowserInit(void) | |
| } | ||
| #endif | ||
|
|
||
| app = new BrowserApp(tex_sharing_avail); | ||
| app = new BrowserApp(tex_sharing_avail, gpuCompositing); | ||
|
|
||
| #ifdef _WIN32 | ||
| CefExecuteProcess(args, app, nullptr); | ||
|
|
@@ -693,7 +694,8 @@ bool obs_module_load(void) | |
|
|
||
| #ifdef SHARED_TEXTURE_SUPPORT_ENABLED | ||
| obs_data_t *private_data = obs_get_private_data(); | ||
| hwaccel = obs_data_get_bool(private_data, "BrowserHWAccel"); | ||
| gpuCompositing = obs_data_get_bool(private_data, "BrowserHWAccel"); | ||
| hwaccel = gpuCompositing; | ||
|
|
||
| if (hwaccel) { | ||
| check_hwaccel_support(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,14 +134,21 @@ bool BrowserSource::CreateBrowser() | |
| if (hwaccel) { | ||
| obs_enter_graphics(); | ||
| tex_sharing_avail = gs_shared_texture_available(); | ||
| #if CHROME_VERSION_BUILD >= 4430 && defined(__APPLE__) && defined(__arm64__) | ||
| // CEF 4430 doesn't seem to work correctly when init'd with shared texture on arm64: | ||
| // - we never see OnAcceleratedPaint called | ||
| // - everything is black | ||
| // so we'll disable that for the time being | ||
|
Comment on lines
+138
to
+141
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a comment on CEF PR 285 recently about OnPaint was being called instead of OnAcceleratedPaint and they had to disable the sandbox to get this to work.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, nice find, will take a look! Not sure if you want potential M1 users to take a look at Apple silicon OBS Browser with/without this change. Won't be able to get to it today. |
||
| tex_sharing_avail = false; | ||
| #endif | ||
|
Comment on lines
+137
to
+143
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed this was within |
||
| obs_leave_graphics(); | ||
| } | ||
| #else | ||
| bool hwaccel = false; | ||
| #endif | ||
|
|
||
| CefRefPtr<BrowserClient> browserClient = new BrowserClient( | ||
| this, hwaccel && tex_sharing_avail, reroute_audio); | ||
| this, tex_sharing_avail, reroute_audio); | ||
|
|
||
| CefWindowInfo windowInfo; | ||
| #if CHROME_VERSION_BUILD < 3071 | ||
|
|
@@ -152,7 +159,7 @@ bool BrowserSource::CreateBrowser() | |
| windowInfo.windowless_rendering_enabled = true; | ||
|
|
||
| #ifdef SHARED_TEXTURE_SUPPORT_ENABLED | ||
| windowInfo.shared_texture_enabled = hwaccel; | ||
| windowInfo.shared_texture_enabled = tex_sharing_avail; | ||
| #endif | ||
|
|
||
| CefBrowserSettings cefBrowserSettings; | ||
|
|
@@ -177,10 +184,10 @@ bool BrowserSource::CreateBrowser() | |
| cefBrowserSettings.default_font_size = 16; | ||
| cefBrowserSettings.default_fixed_font_size = 16; | ||
|
|
||
| #if ENABLE_LOCAL_FILE_URL_SCHEME | ||
| #if ENABLE_LOCAL_FILE_URL_SCHEME && CHROME_VERSION_BUILD < 4430 | ||
| if (is_local) { | ||
| /* Disable web security for file:// URLs to allow | ||
| * local content access to remote APIs */ | ||
| * local content access to remote APIs */ | ||
| cefBrowserSettings.web_security = STATE_DISABLED; | ||
| } | ||
| #endif | ||
|
|
@@ -550,9 +557,14 @@ void BrowserSource::Render() | |
|
|
||
| if (texture) { | ||
| #ifdef __APPLE__ | ||
| gs_effect_t *effect = | ||
| obs_get_base_effect((hwaccel) ? OBS_EFFECT_DEFAULT_RECT | ||
| : OBS_EFFECT_DEFAULT); | ||
| bool useDefaultRect = hwaccel; | ||
| #if CHROME_VERSION_BUILD >= 4430 && defined(__APPLE__) && defined(__arm64__) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need |
||
| useDefaultRect = false; | ||
| flip = false; | ||
| #endif | ||
| gs_effect_t *effect = obs_get_base_effect( | ||
| (useDefaultRect) ? OBS_EFFECT_DEFAULT_RECT | ||
| : OBS_EFFECT_DEFAULT); | ||
| #else | ||
| gs_effect_t *effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); | ||
| #endif | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.