Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Linux with WebRTC m140 (branch 7339), constructing
DesktopAndCursorComposercrashes with SIGSEGV. The root cause is an ABI mismatch in
DesktopCaptureOptions:The prebuilt WebRTC library is compiled with
use_x11=true, which addsX11-specific fields to
DesktopCaptureOptions(conditional onWEBRTC_USE_X11).The JNI CMake build already links against
X11 Xfixes Xrandr Xcompositebut didnot define
WEBRTC_USE_X11as a preprocessor symbol. This caused the structlayout seen by JNI code to differ from the one in the library → reading out of
bounds when passing
optionstoDesktopAndCursorComposer→ SIGSEGV.This affects all Linux architectures (x86-64, arm, arm64) and all distributions.
It was introduced as a regression with the m140 update.
Fix
Root cause (
CMakeLists.txt): addWEBRTC_USE_X11to Linux compiledefinitions so the JNI code and the WebRTC library agree on the struct layout.
JNI safety (
DesktopCapturer.cpp,JNI_ScreenCapturer.cpp,JNI_WindowCapturer.cpp): replace thethrowin the constructor (which wouldcross the JNI boundary as undefined behavior) with a log + early return, and
add null-guards on all methods. The JNI entry points now catch any remaining
C++ exceptions and convert them to Java exceptions.
Testing
Verified on Ubuntu 24.04 (X11 session), linux_x86-64.
Screen and window capture work correctly.