PancakeTAS / obs-nvfbc-v30

OBS Studio (v30+) plugin for NVIDIA'S Frame Buffer Capture (NvFBC) API for Linux.
GNU General Public License v3.0
9 stars 1 forks source link

OBS crashed with X Error: BadAccess #5

Open happyme531 opened 3 months ago

happyme531 commented 3 months ago

As the title said, OBS crashed when adding nvfbc capture source.

~> obs
debug: Found portal inhibitor
debug: Attempted path: /usr/bin/../share/obs/obs-studio/locale/en-US.ini
debug: Attempted path: /usr/bin/../share/obs/obs-studio/locale.ini
debug: Attempted path: /usr/bin/../share/obs/obs-studio/locale/zh-CN.ini
info: Using preferred locale 'zh-CN'
debug: Attempted path: /usr/bin/../share/obs/obs-studio/themes
debug: Attempted path: /usr/bin/../share/obs/obs-studio/themes/
warning: ReadOne on org.freedesktop.portal.Settings returned an invalid reply
warning: [Safe Mode] Unclean shutdown detected!
warning: [Safe Mode] User elected to launch normally.
info: Using EGL/X11
info: CPU Name: AMD Ryzen 9 3900X 12-Core Processor
info: CPU Speed: 2339.044MHz
info: Physical Cores: 12, Logical Cores: 24
info: Physical Memory: 32002MB Total, 19067MB Free
info: Kernel Version: Linux 6.6.44-1-MANJARO
info: Distribution: "Manjaro Linux" Unknown
info: Desktop Environment: KDE (KDE)
info: Session Type: x11
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1
info: Qt Version: 6.7.2 (runtime), 6.7.2 (compiled)
info: Portable mode: false
info: OBS 30.2.1-1 (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
        samples per sec: 48000
        speakers:        2
        max buffering:   960 milliseconds
        buffering type:  dynamically increasing
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter NVIDIA Corporation NVIDIA GeForce RTX 3090/PCIe/SSE2
info: OpenGL loaded successfully, version 3.3.0 NVIDIA 550.107.02, shading language 3.30 NVIDIA via Cg compiler
info: ---------------------------------
info: video settings reset:
        base resolution:   2560x1080
        output resolution: 2560x1080
        downscale filter:  Bicubic
        fps:               90/1
        format:            NV12
        YUV mode:          Rec. 709/Full
info: NV12 texture support enabled
info: P010 texture support not available
info: Audio monitoring device:
        name: 默认
        id: default
info: ---------------------------------
warning: Failed to load 'en-US' text for module: 'decklink-captions.so'
warning: Failed to load 'en-US' text for module: 'decklink-output-ui.so'
libDeckLinkAPI.so: 无法打开共享目标文件: 没有那个文件或目录
warning: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed
warning: Failed to initialize module 'decklink.so'
info: [pipewire] Available capture sources:
info: [pipewire]     - Monitor source
info: [pipewire]     - Window source
info: NVENC supported
warning: LIBVA_DRIVER_NAME variable is set, this could prevent FFmpeg VAAPI from working correctly
info: VAAPI: API version 1.22
info: FFmpeg VAAPI H264 encoding supported
info: FFmpeg VAAPI AV1 encoding not supported
info: FFmpeg VAAPI HEVC encoding supported
info: ---------------------------------
info:   Loaded Modules:
info:     obs-nvfbc.so
info:     text-freetype2.so
info:     rtmp-services.so
info:     obs-x264.so
info:     obs-webrtc.so
info:     obs-vst.so
info:     obs-transitions.so
info:     obs-qsv11.so
info:     obs-outputs.so
info:     obs-libfdk.so
info:     obs-filters.so
info:     obs-ffmpeg.so
info:     linux-v4l2.so
info:     linux-pulseaudio.so
info:     linux-pipewire.so
info:     linux-jack.so
info:     linux-capture.so
info:     linux-alsa.so
info:     image-source.so
info:     frontend-tools.so
info:     decklink-output-ui.so
info:     decklink-captions.so
info: ---------------------------------
info: ---------------------------------
info: Available Encoders:
info:   Video Encoders:
info:   - ffmpeg_svt_av1 (SVT-AV1)
info:   - ffmpeg_aom_av1 (AOM AV1)
info:   - jim_nvenc (NVIDIA NVENC H.264)
info:   - jim_hevc_nvenc (NVIDIA NVENC HEVC)
info:   - jim_av1_nvenc (NVIDIA NVENC AV1)
info:   - ffmpeg_vaapi_tex (FFmpeg VAAPI H.264)
info:   - hevc_ffmpeg_vaapi_tex (FFmpeg VAAPI HEVC)
info:   - obs_x264 (x264)
info:   Audio Encoders:
info:   - ffmpeg_aac (FFmpeg AAC)
info:   - ffmpeg_opus (FFmpeg Opus)
info:   - ffmpeg_pcm_s16le (FFmpeg PCM (16位))
info:   - ffmpeg_pcm_s24le (FFmpeg PCM (24位))
info:   - ffmpeg_pcm_f32le (FFmpeg PCM (32位浮点))
info:   - ffmpeg_alac (FFmpeg ALAC (24位))
info:   - ffmpeg_flac (FFmpeg FLAC (16位))
info:   - libfdk_aac (libfdk AAC)
info: ==== Startup complete ===============================================
info: All scene data cleared
info: ------------------------------------------------
info: pulse-input: Server name: 'PulseAudio (on PipeWire 1.2.2) 15.0.0'
info: pulse-input: Audio format: s32le, 48000 Hz, 2 channels
info: pulse-input: Started recording from 'alsa_output.pci-0000_0a_00.4.analog-stereo.monitor' (default)
info: [Loaded global audio device]: '桌面音频'
info: Switched to scene '场景'
info: ------------------------------------------------
info: Loaded scenes:
info: - scene '场景':
info: - scene '场景 2':
info: ------------------------------------------------
info: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds (source: 桌面音频)

info: Starting capture
error: X Error: BadAccess (attempt to access private resource denied), Major opcode: 152, Minor opcode: BadAtom (invalid Atom parameter), Serial: 34
fish: Job 1, 'obs' terminated by signal SIGSEGV (Address boundary error)
(gdb) bt
#0  0x0000000000000000 in ??? ()
#1  0x00007fa7c7c0f25b in ??? () at /usr/lib/libnvidia-fbc.so.1
#2  0x00007fa7c7c0f44b in ??? () at /usr/lib/libnvidia-fbc.so.1
#3  0x00007fa7c7c0f7f3 in ??? () at /usr/lib/libnvidia-fbc.so.1
#4  0x00007fa7c7c10361 in NvFBCCreateHandle () at /usr/lib/libnvidia-fbc.so.1
#5  0x00007fa7f01f7b12 in start_capture (params=0x7fa82400db60) at src/module.c:40
#6  0x00007fa7f01f8a21 in on_reload (data=0x7fa82400db40) at src/source.c:142
#7  0x00007fa7f01f8b44 in create (settings=0x55aa1095a3e0, source=0x55aa0fcec9c0) at src/source.c:201
#8  0x00007fa84616d1bc in ??? () at /usr/lib/libobs.so.0
#9  0x00007fa84616d6c1 in obs_source_create () at /usr/lib/libobs.so.0
#10 0x000055aa09e0cb7a in ??? ()
#11 0x000055aa09e15385 in ??? ()
#12 0x000055aa09ca5cc2 in ??? ()
#13 0x00007fa843da1784 in ??? () at /usr/lib/libQt6Core.so.6
#14 0x00007fa8450e3333 in ??? () at /usr/lib/libQt6Widgets.so.6
#15 0x00007fa843da16f7 in ??? () at /usr/lib/libQt6Core.so.6
#16 0x00007fa84500e24b in ??? () at /usr/lib/libQt6Widgets.so.6
#17 0x00007fa84500e748 in ??? () at /usr/lib/libQt6Widgets.so.6
#18 0x00007fa84501b12e in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt6Widgets.so.6
#19 0x00007fa844f4c15e in QWidget::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
PancakeTAS commented 3 months ago

I've had this issue as well and wasn't able to find a fix for it sadly.. so I just downgraded my obs version. If someone else wants to take a look at this they can, but I just recently switched to Wayland so I'm not of much help anymore. (i'm on 30.1.2-2)

NVIDIA is currently in the process of rewriting basically all of NvFBC, they added support for EGL in the latest update and in the beta they are adding a pipewire backend for wlroots based compositors on wayland, therefore I don't really know how this is going to continue

PancakeTAS commented 2 months ago

We've taken another look at this, it seems like the dlsym hook simply ceased to exist.. I pushed a dirty commit that creates a separate library that can be LD_PRELOAD'ed and it does fix the crashing issues. However I'm on driver version 560, where practically everything was rewritten.. The library doesn't even load Vulkan anymore. The official Capture SDK update is not out yet and my attempts at using the old API simply result in an "UNSUPPORTED" error. For now there's nothing I can really do. Perhaps if you downgrade your nvidia driver and use LD_PRELOAD the new preload.so you might be able to get it to work again.. but that's not a solution I am satisfied with.