obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
786 stars 226 forks source link

Update CEF to support multi-process structure required for macOS #252

Closed PatTheMav closed 3 years ago

PatTheMav commented 3 years ago

Description

This PR adds the necessary build-system changes for modern CEF versions running on macOS and re-enables features.

Motivation and Context

To ensure compatibility with macOS Catalina and beyond Chromium requires to be run via multiple processes on macOS with the single-process model not being supported anymore.

As such Chromium requires 3 additional helper apps to exist (GPU, Plugin and Renderer) and also the main helper to be packaged in a macOS app bundle. The helpers also require specific entitlements to allow JIT compilation.

This PR adds the necessary changes to cmake to build these helpers. Changes to OBS packaging are also required but are addressed in a PR on the main repo.

Note: The helpers for all intents and purposes replace obs-browser-page on macOS. Also the option to deploy the browser is now assumed by default as CEF will not run when not linked/placed in a macOS app bundle.

How Has This Been Tested?

Types of changes

Checklist:

PatTheMav commented 3 years ago

This requires our planned CEF 4183 update to work.

PatTheMav commented 3 years ago

After a quick chat with @pkviet we decided to add a BROWSER_LEGACY flag that will allow to easily fall back on 3770-era behaviour.

I'll also investigate adding a similar flag to the build scripts and Github workflow to allow a fallback if excrements start hitting a blade-based appliance.

PatTheMav commented 3 years ago

Added the BROWSER_LEGACY flag, it's automatically set by the updated scripts in https://github.com/obsproject/obs-studio/pull/3805 if CEF_BUILD_VERSION=3770 or lower is defined.

WizardCM commented 3 years ago

@pkviet have you tested this branch locally? If so, please mark it as approved.

PatTheMav commented 3 years ago

There are still a few fixes missing that I noticed while dogfooding this, will push an update tomorrow/later.

PatTheMav commented 3 years ago

After defeating clang_format once more, I successfully pushed the small changes I made recently. With those:

The second commit adds the BROWSER_LEGACY flag to all those changes, "undoing" them if set.

The third commit adds a little change required to make texture sharing work with CEF 4183 later.

PatTheMav commented 3 years ago

Just pushed a new iteration of the commits - main changes:

I'll give this a whirl with different build configs tomorrow, but it's looking good so far. With SendExternalBeginFrame disabled I was not able to get the GPU Helper to crash and got solid 60fps in FishGL with 200+ fish and somewhere between 4-8% CPU and ~20% GPU usage (GPU Helper + OBS itself).