flathub / com.obsproject.Studio

This repository is no longer used to build OBS. Issues should be reported at https://github.com/obsproject/obs-studio
https://github.com/obsproject/obs-studio
29 stars 21 forks source link

Pipewire fails to initialize in Wayland #138

Closed roblem closed 3 years ago

roblem commented 3 years ago

Fedora 34 Workstation with pipewire, xdg-desktop-portal-gtk, and xdg-desktop-portal installed. I have two machines like this both running Wayland sessions. On one, pipewire support initializes and I have pipewire screencapture sources in obs. On the other, it persists with X11 (so only X11 screen capture sources are available) even when running under wayland session. From the terminal I ran flatpak run com.obsproject.Studio on both and captured stdout and stderr and here is the diff:

--- obs_studio_doesnt_work.txt  2021-06-09 07:24:05.834278436 +0200
+++ obs_studio_works.txt    2021-06-09 07:23:03.000000000 +0200
@@ -1,18 +1,18 @@
-Qt: Session management error: None of the authentication protocols specified are supported
+QSocketNotifier: Can only be used with threads started with QThread
 Attempted path: share/obs/obs-studio/locale/en-US.ini
 Attempted path: /app/share/obs/obs-studio/locale/en-US.ini
 Attempted path: share/obs/obs-studio/locale.ini
 Attempted path: /app/share/obs/obs-studio/locale.ini
-Attempted path: share/obs/obs-studio/themes/Dark.qss
-Attempted path: /app/share/obs/obs-studio/themes/Dark.qss
-info: CPU Name: AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx
-info: CPU Speed: 2300.000MHz
+Attempted path: share/obs/obs-studio/themes/System.qss
+Attempted path: /app/share/obs/obs-studio/themes/System.qss
+info: Platform: Wayland
+info: CPU Name: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
+info: CPU Speed: 2100.000MHz
 info: Physical Cores: 4, Logical Cores: 8
-info: Physical Memory: 31871MB Total, 21334MB Free
+info: Physical Memory: 15881MB Total, 9631MB Free
 info: Kernel Version: Linux 5.12.9-300.fc34.x86_64
 info: Distribution: "KDE Flatpak runtime" "5.15"
 info: Session Type: wayland
-info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1
 info: Portable mode: false
 QMetaObject::connectSlotsByName: No matching signal for on_tbar_position_valueChanged(int)
 QMetaObject::connectSlotsByName: No matching signal for on_actionShowTransitionProperties_triggered()
@@ -27,20 +27,22 @@
    speakers:        2
 info: ---------------------------------
 info: Initializing OpenGL...
-info: Loading up OpenGL on adapter AMD AMD Radeon(TM) Vega 10 Graphics (RAVEN, DRM 3.40.0, 5.12.9-300.fc34.x86_64, LLVM 11.1.0)
+info: Using EGL/Wayland
+info: Initialized EGL 1.4
+info: Loading up OpenGL on adapter Intel Open Source Technology Center Mesa DRI Intel(R) UHD Graphics 620 (KBL GT2)
 info: OpenGL loaded successfully, version 4.6 (Core Profile) Mesa 21.1.1 (git-abac12bc75), shading language 4.60
 info: ---------------------------------
 info: video settings reset:
    base resolution:   1920x1080
    output resolution: 1920x1080
    downscale filter:  Bicubic
-   fps:               30/1
+   fps:               60/1
    format:            NV12
    YUV mode:          709/Partial
 info: NV12 texture support not available
 info: Audio monitoring device:
-   name: Default
-   id: default
+   name: Monitor of Virtual_Sink
+   id: Virtual_Sink.monitor
 info: ---------------------------------
 warning: Failed to load 'en-US' text for module: 'decklink-captions.so'
 warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so'
@@ -84,91 +86,72 @@
 info: ------------------------------------------------
 info: All scene data cleared
 info: ------------------------------------------------
-info: pulse-input: Server name: 'PulseAudio (on PipeWire 0.3.29) 14.0.0'
-info: pulse-input: Audio format: s24le, 48000 Hz, 2 channels
-info: pulse-input: Sample format s24le not supported by OBS,using float32le instead for recording
-info: pulse-input: Started recording from 'alsa_output.usb-Schiit_Audio_I_m_Fulla_Schiit-00.iec958-stereo.monitor'
-info: [Loaded global audio device]: 'Desktop Audio'
-info: pulse-input: Server name: 'PulseAudio (on PipeWire 0.3.29) 14.0.0'
-info: pulse-input: Audio format: s16le, 48000 Hz, 2 channels
-info: pulse-input: Started recording from 'alsa_input.usb-FIFINE_Microphones_FIFINE_K670_Microphone_REV1.0-00.iec958-stereo'
-info: [Loaded global audio device]: 'Mic/Aux'
-info:     - filter: 'Noise Suppression' (noise_suppress_filter_v2)
-info:     - filter: 'Gain' (gain_filter)
+info: PipeWire initialized (sender name: 1_326)
 info: Switched to scene 'Scene'
 info: ------------------------------------------------
 info: Loaded scenes:
 info: - scene 'Scene':
 info: ------------------------------------------------
+qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
 Attempted path: share/obs/obs-studio/images/overflow.png
 Attempted path: /app/share/obs/obs-studio/images/overflow.png
-info: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds (source: Desktop Audio)
-
-info: adding 21 milliseconds of audio buffering, total audio buffering is now 64 milliseconds (source: Mic/Aux)
-
-info: adding 106 milliseconds of audio buffering, total audio buffering is now 170 milliseconds (source: Mic/Aux)
-
 info: ==== Shutting down ==================================================
-info: pulse-input: Stopped recording from 'alsa_output.usb-Schiit_Audio_I_m_Fulla_Schiit-00.iec958-stereo.monitor'
-info: pulse-input: Got 129 packets with 132096 frames
-info: pulse-input: Stopped recording from 'alsa_input.usb-FIFINE_Microphones_FIFINE_K670_Microphone_REV1.0-00.iec958-stereo'
-info: pulse-input: Got 129 packets with 132096 frames
 info: All scene data cleared
 info: ------------------------------------------------
 info: [Scripting] Total detached callbacks: 0
 info: Freeing OBS context data
 info: == Profiler Results =============================
-info: run_program_init: 521.869 ms
-info:  ┣OBSApp::AppInit: 1.754 ms
-info:  ┃ ┗OBSApp::InitLocale: 0.752 ms
-info:  ┗OBSApp::OBSInit: 411.279 ms
-info:    ┣obs_startup: 12.711 ms
-info:    ┗OBSBasic::OBSInit: 297.807 ms
-info:      ┣OBSBasic::InitBasicConfig: 0.143 ms
-info:      ┣OBSBasic::ResetAudio: 0.241 ms
-info:      ┣OBSBasic::ResetVideo: 64.234 ms
-info:      ┣OBSBasic::InitOBSCallbacks: 0.008 ms
-info:      ┣OBSBasic::InitHotkeys: 0.049 ms
-info:      ┣obs_load_all_modules: 123.065 ms
-info:      ┃ ┣obs_init_module(decklink-captions.so): 0.034 ms
-info:      ┃ ┣obs_init_module(decklink-ouput-ui.so): 0.668 ms
-info:      ┃ ┣obs_init_module(frontend-tools.so): 83.726 ms
+info: run_program_init: 728.849 ms
+info:  ┣OBSApp::AppInit: 1.924 ms
+info:  ┃ ┗OBSApp::InitLocale: 1.193 ms
+info:  ┗OBSApp::OBSInit: 436.485 ms
+info:    ┣obs_startup: 11.885 ms
+info:    ┗OBSBasic::OBSInit: 326.747 ms
+info:      ┣OBSBasic::InitBasicConfig: 0.197 ms
+info:      ┣OBSBasic::ResetAudio: 0.365 ms
+info:      ┣OBSBasic::ResetVideo: 64.606 ms
+info:      ┣OBSBasic::InitOBSCallbacks: 0.005 ms
+info:      ┣OBSBasic::InitHotkeys: 0.043 ms
+info:      ┣obs_load_all_modules: 174.481 ms
+info:      ┃ ┣obs_init_module(decklink-captions.so): 0.03 ms
+info:      ┃ ┣obs_init_module(decklink-ouput-ui.so): 0.692 ms
+info:      ┃ ┣obs_init_module(frontend-tools.so): 119.223 ms
 info:      ┃ ┣obs_init_module(image-source.so): 0.007 ms
-info:      ┃ ┣obs_init_module(linux-capture.so): 0.395 ms
-info:      ┃ ┣obs_init_module(linux-decklink.so): 0.131 ms
+info:      ┃ ┣obs_init_module(linux-capture.so): 0.313 ms
+info:      ┃ ┣obs_init_module(linux-decklink.so): 0.199 ms
 info:      ┃ ┣obs_init_module(linux-jack.so): 0.002 ms
-info:      ┃ ┣obs_init_module(linux-pulseaudio.so): 0.001 ms
-info:      ┃ ┣obs_init_module(linux-v4l2.so): 0.163 ms
-info:      ┃ ┣obs_init_module(obs-browser.so): 0.07 ms
-info:      ┃ ┣obs_init_module(obs-ffmpeg.so): 0.207 ms
-info:      ┃ ┃ ┗nvenc_check: 0.186 ms
-info:      ┃ ┣obs_init_module(obs-filters.so): 0.024 ms
+info:      ┃ ┣obs_init_module(linux-pulseaudio.so): 0.002 ms
+info:      ┃ ┣obs_init_module(linux-v4l2.so): 0.264 ms
+info:      ┃ ┣obs_init_module(obs-browser.so): 0.075 ms
+info:      ┃ ┣obs_init_module(obs-ffmpeg.so): 0.282 ms
+info:      ┃ ┃ ┗nvenc_check: 0.246 ms
+info:      ┃ ┣obs_init_module(obs-filters.so): 0.026 ms
 info:      ┃ ┣obs_init_module(obs-libfdk.so): 0.001 ms
 info:      ┃ ┣obs_init_module(obs-outputs.so): 0.003 ms
-info:      ┃ ┣obs_init_module(obs-transitions.so): 0.008 ms
-info:      ┃ ┣obs_init_module(obs-v4l2sink.so): 0.718 ms
+info:      ┃ ┣obs_init_module(obs-transitions.so): 0.007 ms
+info:      ┃ ┣obs_init_module(obs-v4l2sink.so): 0.794 ms
 info:      ┃ ┣obs_init_module(obs-vst.so): 0.004 ms
-info:      ┃ ┣obs_init_module(obs-x264.so): 0.002 ms
-info:      ┃ ┣obs_init_module(rtmp-services.so): 1.306 ms
-info:      ┃ ┗obs_init_module(text-freetype2.so): 0.013 ms
-info:      ┣OBSBasic::ResetOutputs: 0.127 ms
-info:      ┣OBSBasic::CreateHotkeys: 0.038 ms
-info:      ┣OBSBasic::InitService: 1.492 ms
-info:      ┣OBSBasic::InitPrimitives: 0.125 ms
-info:      ┗OBSBasic::Load: 20.59 ms
-info: obs_hotkey_thread(25 ms): min=0.102 ms, median=0.224 ms, max=4.193 ms, 99th percentile=0.719 ms, 100% below 25 ms
-info: audio_thread(Audio): min=0 ms, median=0.048 ms, max=0.232 ms, 99th percentile=0.183 ms
-info: obs_graphics_thread(33.3333 ms): min=0.206 ms, median=2.914 ms, max=28.284 ms, 99th percentile=28.284 ms, 100% below 33.333 ms
-info:  ┣tick_sources: min=0.001 ms, median=0.011 ms, max=0.092 ms, 99th percentile=0.092 ms
-info:  ┣output_frame: min=0.109 ms, median=0.171 ms, max=5.443 ms, 99th percentile=5.443 ms
-info:  ┃ ┗gs_context(video->graphics): min=0.108 ms, median=0.17 ms, max=5.443 ms, 99th percentile=5.443 ms
-info:  ┃   ┣render_video: min=0.028 ms, median=0.045 ms, max=2.478 ms, 99th percentile=2.478 ms
-info:  ┃   ┃ ┗render_main_texture: min=0.024 ms, median=0.04 ms, max=2.465 ms, 99th percentile=2.465 ms
-info:  ┃   ┗gs_flush: min=0.071 ms, median=0.122 ms, max=2.932 ms, 99th percentile=2.932 ms
-info:  ┗render_displays: min=0.003 ms, median=2.605 ms, max=28.063 ms, 99th percentile=28.063 ms
+info:      ┃ ┣obs_init_module(obs-x264.so): 0.001 ms
+info:      ┃ ┣obs_init_module(rtmp-services.so): 0.609 ms
+info:      ┃ ┗obs_init_module(text-freetype2.so): 0.012 ms
+info:      ┣OBSBasic::ResetOutputs: 0.277 ms
+info:      ┣OBSBasic::CreateHotkeys: 0.252 ms
+info:      ┣OBSBasic::InitService: 1.731 ms
+info:      ┣OBSBasic::InitPrimitives: 0.243 ms
+info:      ┗OBSBasic::Load: 13.463 ms
+info: obs_hotkey_thread(25 ms): min=0 ms, median=0.002 ms, max=0.023 ms, 99th percentile=0.023 ms, 100% below 25 ms
+info: audio_thread(Audio): min=0 ms, median=0.057 ms, max=0.206 ms, 99th percentile=0.178 ms
+info: obs_graphics_thread(16.6667 ms): min=0.042 ms, median=1.984 ms, max=9.522 ms, 99th percentile=9.05 ms, 100% below 16.667 ms
+info:  ┣tick_sources: min=0 ms, median=0.017 ms, max=0.099 ms, 99th percentile=0.077 ms
+info:  ┣output_frame: min=0.019 ms, median=0.13 ms, max=4.356 ms, 99th percentile=3.061 ms
+info:  ┃ ┗gs_context(video->graphics): min=0.019 ms, median=0.129 ms, max=4.355 ms, 99th percentile=3.061 ms
+info:  ┃   ┣render_video: min=0.014 ms, median=0.11 ms, max=4.321 ms, 99th percentile=2.885 ms
+info:  ┃   ┃ ┗render_main_texture: min=0.011 ms, median=0.099 ms, max=4.273 ms, 99th percentile=2.878 ms
+info:  ┃   ┗gs_flush: min=0 ms, median=0.001 ms, max=0.157 ms, 99th percentile=0.004 ms
+info:  ┗render_displays: min=0.004 ms, median=1.687 ms, max=9.047 ms, 99th percentile=5.897 ms
 info: =================================================
 info: == Profiler Time Between Calls ==================
-info: obs_hotkey_thread(25 ms): min=25.183 ms, median=25.304 ms, max=29.272 ms, 94.4% within ±2% of 25 ms (0% lower, 5.6% higher)
-info: obs_graphics_thread(33.3333 ms): min=33.309 ms, median=33.334 ms, max=33.357 ms, 100% within ±2% of 33.333 ms (0% lower, 0% higher)
+info: obs_hotkey_thread(25 ms): min=25.068 ms, median=25.143 ms, max=25.357 ms, 100% within ±2% of 25 ms (0% lower, 0% higher)
+info: obs_graphics_thread(16.6667 ms): min=16.553 ms, median=16.667 ms, max=16.758 ms, 100% within ±2% of 16.667 ms (0% lower, 0% higher)
 info: =================================================
 info: Number of memory leaks: 0

The one that works with pipewire is an upgraded machine that was running older obs versions with wayland support, so I suspect I am missing a dependency.

flatpak info from both machines:

OBS Studio - Live streaming and video recording software

          ID: com.obsproject.Studio
         Ref: app/com.obsproject.Studio/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 27.0.0
     License: GPL-2.0
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 475.3 MB
     Runtime: org.kde.Platform/x86_64/5.15
         Sdk: org.kde.Sdk/x86_64/5.15

      Commit: a75a9f2b382c1f16fdc8806855613f70bbfe63ab71a2baad37f8c488643e6b4a
      Parent: d945b9a3cb80c2856eef7b8a5bcb620b0db823f7d1a3c85053469a97b9b8da86
     Subject: Make VST plugins be found (d447d197)
        Date: 2021-06-01 21:19:56 +0000
GeorgesStavracas commented 3 years ago

The one that doesn't work is running on top of X11:

-info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1

The PipeWire capture only works on Wayland, or on X11 with the OBS_USE_EGL=1 environment variable

roblem commented 3 years ago

Yes, that message confused me as I am running a wayland session and launching obs when the x11 window system message appears:

info: Distribution: "KDE Flatpak runtime" "5.15"
info: Session Type: wayland
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1

Do I have to invoke the flatpak a certain way in wayland to use wayland rather than x11?

Also, for sure I am using wayland not x11 in gnome: wayland

roblem commented 3 years ago

If I launch with QT_QPA_PLATFORM=wayland flatpak run com.obsproject.Studio, I see the pipewire sources and I have

info: Platform: Wayland
info: Session Type: wayland

This env variable is unset on the machine that works.

GeorgesStavracas commented 3 years ago

This is really odd. Qt 5.15 indeed doesn't use the Wayland backend when you're running GNOME, but the KDE platform in Flathub removes this behavior. I'm not sure what's going on; perhaps there's any Qt env var to debug which backend is it picking, and why?

roblem commented 3 years ago

Not sure, but it is possible that some/all of the kde platform files were installed in an x11 session as I switched over to x11 early on in setting this computer up and forgot to switch back. Since both now work under Wayland I'll keep things as is in case anyone has ideas about how to debug the backend.

roblem commented 3 years ago

OK, the issue was the "bad" machine was setting

export QT_QPA_PLATFORM='xcb'

I removed that and it works as expected.