Add full support for CEF 4638 #323
No reviewers
Labels
No labels
area/accessibility
area/dependency
Confirmed
Crash Report
Delayed
Design Issue
Duplicate
Feedback required
Good first issue
kind/bug
kind/cleanup
kind/enhancement
platform/linux
platform/macos
platform/windows
priority/high
Question
Request for Comments
Seeking Other Contributors
Seeking Testers
Won't Fix / By Design
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-obsproject/obs-browser!323
Loading…
Reference in a new issue
No description provided.
Delete branch "cef-4638-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Introduces necessary fixes for compatibility with CEF 4638 due to API changes within CEF.
Note: This PR stays a draft for now as we need a proper solution to the upstream changes regarding web security disabling for local file support.
Motivation and Context
Make obs-browser compatible with CEF 4638 which is required for M1 support.
How Has This Been Tested?
Types of changes
Checklist:
This will have to be tested on Windows and Linux.
It should work fine given that this is CEF's reference implementation now (they unified this call across all OS).
Verified on both. Looks good to me.
Added
RequestHandlerandResourceRequestHandlercallbacks to intercept requests made by a browser source. While this allows us to "detect" CORS requests from local files (via thenullOrigin header), in my tests I've been able to change other headers and even the URL insideOnBeforeResourceLoadbut any changes to the Origin header were ignored.After discussion with the team, we came to the following conclusion:
<script>works as intendednullorigin for local URLsAs the latter point mirrors behaviour of current browsers, we deem it a "won't fix" coupled with updated user guidance once we update.
obs-studioIssue A: Building on Ubuntu 20.04 with 4280 fails, with a few errors (See Discord)
Issue B: Every instance of a browser source spams this message to the log, and there is no video:
[1120/215034.001000:WARNING:task_impl.cc(31)] No task runner for threadId 0The more browsers that are added, the more spam there is. The browser can be removed, stopping the spam, but it starts up again when you go to close OBS, and requires killing.
OBS functions as expected when no browser stuff is ever loaded.
That's weird given that most changes are guarded by a version check for newer CEF versions only, the changes that affect every version is proper use of
nullptrand Dillon's change to usecef_window_open_disposition_tfrom what I could see..@PatTheMav I can try using a fresh dev environment in the morning, just to make sure that there isn't some random issue.
Fresh ENV - Building with 4280 still errors, and I also discovered that I was only able to build with the spotify 4638 CEF because of previous cmake cache. I need a download of 4638 with the correct CEF wrapper.
@ -28,6 +29,10 @@ struct BrowserSource;class BrowserClient : public CefClient,I've submitted a bugfix for the reported issue on older CEF.
Using the latest version:
CEF 4280 builds and works as expected
CEF 4638 builds and works as expected, with the bonus that it doesn't throw any threadrunner errors.
Big thing to note: At least on Ubuntu 20.04, in order to use 4638 you need to use a fresh build environment. For example, having a 4280-based environment then reconfiguring with cmake will cause tons of wacky errors on runtime, and the browser source will simply not work.
Perhaps there is some way to detect an old version of cef in cmakelists, to throw an explicit configuration error if the version changes?
Remaining things to test/fix:
From what I could tell that is by design -
CEF_ROOT_DIRonly specifies a hint forFindCEFto look for its required files - once they are found, these values are set as cache variables and changing the root directory won't have any effect, as the library is already found.The intended way is to delete the cache variables associated with CEF (except for the root directory) and re-run CMake again (so
FindCEFwill find the "new" library and headers).As for a way to fix this: CEF would have to produce a proper CMake package with version and target configuration - then you could do
find_package(CEF 95.xxx.xxx)and specify the exact version you want. As long as that isn't the case you'd have to do version management by hand.On Wed, 2021-11-24 at 04:35 -0800, Patrick Heyer wrote:
Would you be able to 'remind' (:D) me on the correct or most efficient
way to do that?
Many thanks!
Either run
ccmake -S . -B [YOUR_BUILD_DIR], then presstto see the advanced entries and delete every entry starting withCEF_butCEF_ROOT_DIR.Or edit
CMakeCache.txtin your build directory directly and also remove those entries.This seems to fix AJAX calls to local files in local file mode, but may break large media files.
Edit: Verified this breaks large media files. But only sometimes?
Large media file playback seems fine to me, I checked local CORS with your test suite, both XHR and Fetch seem to work fine. Pointing to a non-existing
videosource led to a hard crash though, as we don't check for file existence before creating aCefStreamReaderit seems.Loading remote will still be blocked by every host that doesn't use
Access-Control-Allow-Origin: *but that's kind-of obvious.Edit: Added a fix for the missing file issue - how did you recreate the large media file issue? I managed to watch an entire TV episode via browser source without issue just now.
For some reason, the diff below fixes the browser panel resize issue on Linux. If we end up using this fix temporarily, I recommend we scope it to 4638.
This is probably not the best solution, but it does work.
Confirmed the fix, added as additional commit.