snapcrafters / obs-studio

This is a community-supported modified build of OBS Studio.
https://snapcraft.io/obs-studio
111 stars 37 forks source link

[Bug]: gphoto2 plugin causes many memory leaks #164

Closed archerallstars closed 8 months ago

archerallstars commented 1 year ago

What happened?

The app, when using with gphoto2 plugin, will cause a lot of memory leaks (see the last line of terminal output), as shown in the screen recording below:

https://user-images.githubusercontent.com/1403194/185512589-9afd160a-b112-4d8f-9ce8-c7b436029cb1.mp4

What should have happened?

There should be no memory leaks.

Output of snap info $snap_name

name:    obs-studio
summary: Free and open source software for live streaming and screen
  recording
publisher: Snapcrafters
store-url: https://snapcraft.io/obs-studio
contact:   https://github.com/snapcrafters/obs-studio/issues
license:   GPL-2.0
description: |
  OBS Studio is software designed for capturing, compositing, encoding,
  recording, and streaming video content, efficiently. _This is a
  community-supported modified build of OBS Studio; please file issues on the
  Snapcrafters GitHub:_ https://github.com/snapcrafters/obs-studio/issues

  **Batteries included**

  The snap of OBS studio comes pre-loaded with some extra features:

    * Supports **nvenc (NVIDIA) and VA-API (AMD & Intel) accelerated video
    encoding**.
    * **Advanced Scene Switcher** plugin; an automated scene switcher
    * **Browser** plugin; CEF-based OBS Studio browser plugin
    * **Directory Watch Media** plugin; filter you can add to a media source
    to load the oldest or newest file in a directory.
    * **Dynamic Delay** plugin; filter for dynamic delaying a video source.
    * **Freeze Filter** plugin; freeze a source using a filter.
    * **gPhoto** plugin; connect DSLR cameras with obs-studio via gPhoto.
    * **GStreamer** plugins; feed GStreamer launch pipelines into OBS Studio
    and use GStreamer encoder elements.
    * **Move Transition** plugin; move sources to a new position during a
    scene transition.
    * **NDI** plugin; Network A/V via NewTek's NDI.
    * **NvFBC** plugin; screen capture via NVIDIA FBC API. Requires NvFBC
    patches for Nvidia drivers for consumer-grade GPUs.
    * **RGB Levels** plugin; simple filter to adjust RGB levels.
    * **Source Switcher** plugin; to switch between a list of sources.
    * **Spectralizer** plugin; audio visualization using fftw.
    * **StreamFX** plugin; collection modern effects filters and transitions.
    * **Text Pango** plugin; Provides a text source rendered using Pango with
    multi-language support, emoji support, vertical rendering and RTL
    support.
    * **Transition Matrix** plugin; customize Any -> One or One -> One scene
    transitions.
    * **VNC Source** plugin; VNC viewer that works as a source.
    * **Websockets** plugin; remote-control OBS Studio through WebSockets.

  **Connecting Interfaces**

  For the best experience, you'll want to connect the following interfaces.

     sudo snap connect obs-studio:alsa
     sudo snap connect obs-studio:audio-record
     sudo snap connect obs-studio:avahi-control
     sudo snap connect obs-studio:camera
     sudo snap connect obs-studio:jack1
     sudo snap connect obs-studio:kernel-module-observe

  **NDI**

  If you want to use the NDI plugin you'll need to connect the Avahi Control
  interface.

     snap connect obs-studio:avahi-control

  **Virtual Camera**

  Starting with OBS 26.1.0, Virtual Camera support is integrated. Here's how
  to install and configure `v4l2loopback`:

     sudo snap connect obs-studio:kernel-module-observe
     sudo apt -y install v4l2loopback-dkms v4l2loopback-utils
     echo "options v4l2loopback devices=1 video_nr=13 card_label='OBS Virtual
     Camera'    exclusive_caps=1" | sudo tee
     /etc/modprobe.d/v4l2loopback.conf
     echo "v4l2loopback" | sudo tee /etc/modules-load.d/v4l2loopback.conf
     sudo modprobe -r v4l2loopback
     sudo modprobe v4l2loopback devices=1 video_nr=13 card_label='OBS Virtual
     Camera' exclusive_caps=1

  **NOTE!** Using `video_nr` greater than 64 will not work.

  **Removable Storage**

  To access content on external storage, connect to the removable-media plug:

     snap connect obs-studio:removable-media

  **gPhoto**

  The gPhoto plugin allows some DSLR cameras to be connected via USB. You'll
  need to connect the Raw USB interface.

     snap connect obs-studio:raw-usb

  **3rd Party plugins**

  To install pre-compiled plugins, download and extract the plugin to
  `~/snap/obs-studio/current/.config/obs-studio/plugins/`.

  This is how the Input Overlay plugin looks when correctly installed:

     /home/username/snap/obs-studio/current/.config/obs-studio/plugins/
     └── input-overlay
         ├── bin
         │   └── 64bit
         │       └── input-overlay.so
         └── data
             └── locale
                 ├── de-DE.ini
                 ├── en-US.ini
                 └── ru-RU.ini

  If you want to use the Input Overlay plugin, you'll also need to connect
  the joystick interface:

     snap connect obs-studio:joystick
commands:
  - obs-studio.eglinfo
  - obs-studio.ffmpeg
  - obs-studio.ffplay
  - obs-studio.ffprobe
  - obs-studio.glxinfo
  - obs-studio
  - obs-studio.srt-ffplay
  - obs-studio.srt-file-transmit
  - obs-studio.srt-live-transmit
  - obs-studio.srt-tunnel
  - obs-studio.vainfo
  - obs-studio.vdpauinfo
  - obs-studio.vulkaninfo
snap-id:      6uLU2MJmBURfLNz4rmL4WT2CmtVULE2u
tracking:     latest/stable
refresh-date: 15 days ago, at 06:18 -04
channels:
  latest/stable:    27.1.3 2021-12-20 (1284) 418MB -
  latest/candidate: ↑                              
  latest/beta:      ↑                              
  latest/edge:      27.2.1 2022-02-24 (1287) 439MB -
installed:          27.1.3            (1284) 418MB -

Output of snap connections $snap_name

Interface                 Plug                                 Slot                            Notes
alsa                      obs-studio:alsa                      :alsa                           manual
audio-playback            obs-studio:audio-playback            :audio-playback                 -
audio-record              obs-studio:audio-record              :audio-record                   -
avahi-control             obs-studio:avahi-control             :avahi-control                  manual
browser-support           obs-studio:browser-support           :browser-support                -
camera                    obs-studio:camera                    :camera                         -
content[gtk-3-themes]     obs-studio:gtk-3-themes              gtk-common-themes:gtk-3-themes  -
content[icon-themes]      obs-studio:icon-themes               gtk-common-themes:icon-themes   -
content[sound-themes]     obs-studio:sound-themes              gtk-common-themes:sound-themes  -
desktop                   obs-studio:desktop                   :desktop                        -
desktop-legacy            obs-studio:desktop-legacy            :desktop-legacy                 -
gsettings                 obs-studio:gsettings                 :gsettings                      -
hardware-observe          obs-studio:hardware-observe          -                               -
home                      obs-studio:home                      :home                           -
jack1                     obs-studio:jack1                     :jack1                          manual
joystick                  obs-studio:joystick                  :joystick                       manual
kernel-module-observe     obs-studio:kernel-module-observe     :kernel-module-observe          manual
network                   obs-studio:network                   :network                        -
network-bind              obs-studio:network-bind              :network-bind                   -
opengl                    obs-studio:opengl                    :opengl                         -
password-manager-service  obs-studio:password-manager-service  -                               -
process-control           obs-studio:process-control           -                               -
pulseaudio                obs-studio:pulseaudio                :pulseaudio                     -
raw-usb                   obs-studio:raw-usb                   :raw-usb                        manual
removable-media           obs-studio:removable-media           :removable-media                manual
screen-inhibit-control    obs-studio:screen-inhibit-control    :screen-inhibit-control         -
screencast-legacy         obs-studio:screencast-legacy         :screencast-legacy              manual
system-observe            obs-studio:system-observe            -                               -
unity7                    obs-studio:unity7                    :unity7                         -
upower-observe            obs-studio:upower-observe            :upower-observe                 -
wayland                   obs-studio:wayland                   :wayland                        -
x11                       obs-studio:x11                       :x11                            -

Output of snap version

snap                 2.56.2-1.36
snapd                2.56.2-1.36
series               16
opensuse-tumbleweed  20220816
kernel               5.19.1-1-default

Relevant log output

-

Teminal output of app

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QSocketNotifier: Can only be used with threads started with QThread

(process:7469): Gtk-WARNING **: 19:25:11.006: Locale not supported by C library.
    Using the fallback 'C' locale.
Gtk-Message: 19:25:11.006: Failed to load module "lunar-calendar-module"
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/themes/Dark.qss
Attempted path: /usr/share/obs/obs-studio/themes/Dark.qss
info: Command Line Arguments: --multi
info: Platform: Wayland
info: CPU Name: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
info: CPU Speed: 3400.019MHz
info: Physical Cores: 4, Logical Cores: 8
info: Physical Memory: 7829MB Total, 132MB Free
info: Kernel Version: Linux 5.19.1-1-default
info: Distribution: "Ubuntu Core" "20"
info: Session Type: wayland
info: Portable mode: false
Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg
Attempted path: /usr/share/obs/obs-studio/themes/Dark/no_sources.svg
QMetaObject::connectSlotsByName: No matching signal for on_tbar_position_valueChanged(int)
QMetaObject::connectSlotsByName: No matching signal for on_actionShowTransitionProperties_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionHideTransitionProperties_triggered()
info: OBS 27.1.3-modified (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
    samples per sec: 48000
    speakers:        2
info: ---------------------------------
info: Initializing OpenGL...
info: Using EGL/Wayland
info: Initialized EGL 1.5
info: Loading up OpenGL on adapter Intel Mesa Intel(R) UHD Graphics 620 (KBL GT2)
info: OpenGL loaded successfully, version 4.6 (Core Profile) Mesa 21.0.3, shading language 4.60
info: ---------------------------------
info: video settings reset:
    base resolution:   1920x1080
    output resolution: 1280x720
    downscale filter:  Bicubic
    fps:               30/1
    format:            NV12
    YUV mode:          709/Partial
info: NV12 texture support not available
info: Audio monitoring device:
    name: Default
    id: default
info: ---------------------------------
info: [StreamFX] Loading Version 0.11.0.0c1-g2d7fce5a
info: [StreamFX] <gfx::opengl> Version 4.6 initialized.
info: [StreamFX] Loaded Version 0.11.0.0c1-g2d7fce5a
info: [adv-ss] version: 1.16.5
info: [adv-ss] version: 82da6b32175081a3c8ca9c3aeed267999f460dcb
info: [adv-ss] curl loaded successfully
info: [adv-ss] found curl library
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'
info: [Downstream Keyer] loaded version 0.2.1
info: [Freeze Filter] loaded version 0.3.2
info: [Gradient Source] loaded version 0.2.0
warning: Failed to load 'en-US' text for module: 'liblooking-glass-obs.so'
Looking Glass OBS Client (B4)
info: [pango]: Loaded system fontconfig
info: [pipewire] Available captures:
info: [pipewire]     - Desktop capture
info: [pipewire]     - Window capture
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
warning: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed
info: No blackmagic support
info: [linux-vkcapture] plugin loaded successfully (version 1.1.0)
info: [Move Transition] loaded version 2.5.2
error: os_dlopen(libnvidia-fbc.so.1->libnvidia-fbc.so.1): libnvidia-fbc.so.1: cannot open shared object file: No such file or directory

error: Unable to load NvFBC library
warning: Failed to initialize module 'nvfbc.so'
warning: Failed to load 'en-US' text for module: 'obs-audio-pan-filter.so'
info: [obs-audio-pan-filter] plugin loaded successfully (version 0.1.2)
warning: Failed to load 'en-US' text for module: 'obs-backgroundremoval.so'
info: [obs-backgroundremoval] plugin loaded successfully (version 0.4.0)
info: [obs-browser]: Version 2.16.3
info: [obs-browser]: CEF Version 87.1.14+ga29e9a3+chromium-87.0.4280.141
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): libnvidia-encode.so.1: cannot open shared object file: No such file or directory

info: FFMPEG VAAPI supported
warning: Failed to load 'en-US' text for module: 'obs-gphoto.so'
info: obs-gstreamer build: 219a629
info: [obs-ndi] hello ! (version 4.9.1)
info: [obs-ndi] Trying ''
info: [obs-ndi] Trying '/usr/lib'
info: [obs-ndi] Trying '/usr/local/lib'
info: [obs-ndi] Found NDI library at '/usr/local/lib/libndi.so.4'
info: [obs-ndi] NDI runtime loaded successfully
info: [obs-ndi] NDI library initialized successfully (NDI SDK LINUX 18:32:11 Jun 30 2020 4.5.3)
warning: Failed to load 'en-US' text for module: 'obs-vnc.so'
info: [obs-vnc] plugin loaded successfully (version 0.4.0)
info: [obs-websocket] you can haz websockets (version 4.9.1)
info: [obs-websocket] qt version (compile-time): 5.15.2 ; qt version (run-time): 5.15.2
info: [obs-websocket] module loaded!
info: [Replay Source] loaded version 1.6.9
info: [Source Copy] loaded version 0.1.3
info: [Source Record] loaded version 0.2.6
info: [Source Switcher] loaded version 0.3.0
info: [spectralizer] Loading v1.3.2 build time 2021.12.20 11:59
info: [TimeWarpScan] loaded version 0.1.6
info: [Transition Table] loaded version 0.2.2
info: VLC found, VLC video source enabled
info: ---------------------------------
info:   Loaded Modules:
info:     vlc-video.so
info:     transition-table.so
info:     time-warp-scan.so
info:     text-freetype2.so
info:     spectralizer.so
info:     source-switcher.so
info:     source-record.so
info:     source-copy.so
info:     sndio.so
info:     scale-to-sound.so
info:     rtmp-services.so
info:     replay-source.so
info:     recursion-effect.so
info:     obs-x264.so
info:     obs-websocket.so
info:     obs-vst.so
info:     obs-vnc.so
info:     obs-transitions.so
info:     obs-rtspserver.so
info:     obs-rgb-levels-filter.so
info:     obs-outputs.so
info:     obs-ndi.so
info:     obs-libfdk.so
info:     obs-gstreamer.so
info:     obs-gphoto.so
info:     obs-filters.so
info:     obs-ffmpeg.so
info:     obs-browser.so
info:     obs-backgroundremoval.so
info:     obs-audio-pan-filter.so
info:     nvfbc.so
info:     move-transition.so
info:     linux-vkcapture.so
info:     linux-v4l2.so
info:     linux-pulseaudio.so
info:     linux-jack.so
info:     linux-decklink.so
info:     linux-capture.so
info:     linux-alsa.so
info:     libtext-pango.so
info:     liblooking-glass-obs.so
info:     image-source.so
info:     gradient-source.so
info:     frontend-tools.so
info:     freeze-filter.so
info:     dynamic-delay.so
info:     dvd-screensaver.so
info:     downstream-keyer.so
info:     dir-watch-media.so
info:     decklink-ouput-ui.so
info:     decklink-captions.so
info:     advanced-scene-switcher.so
info:     StreamFX.so
info: ---------------------------------
info: ==== Startup complete ===============================================
info: All scene data cleared
info: ------------------------------------------------
info: pulse-input: Server name: 'PulseAudio (on PipeWire 0.3.56) 15.0.0'
info: pulse-input: Audio format: s16le, 16000 Hz, 1 channels
info: pulse-input: Started recording from 'bluez_output.74_45_CE_B2_5D_F6.headset-head-unit.monitor'
info: [Loaded global audio device]: 'Desktop Audio'
info: pulse-input: Server name: 'PulseAudio (on PipeWire 0.3.56) 15.0.0'
info: pulse-input: Audio format: s16le, 16000 Hz, 1 channels
info: pulse-input: Started recording from 'bluez_input.74_45_CE_B2_5D_F6.headset-head-unit'
info: [Loaded global audio device]: 'Mic/Aux'
info: Switched to scene 'Scene'
info: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds (source: Desktop Audio)

info: gphoto preview captures images of size 1024 x 768
info: [adv-ss] trying to reconnect to  in 10 seconds.
info: ------------------------------------------------
info: [adv-ss] started
info: Loaded scenes:
info: - scene 'Scene':
info:     - source: 'gPhoto live preview capture' (gphoto-capture-preview)
info: ------------------------------------------------
info: [obs-websocket] WSServer::start: Not locked to IPv4 bindings
info: [obs-websocket] server started successfully on port 4444
info: [obs-websocket] IO thread started.
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
Attempted path: share/obs/obs-studio/images/overflow.png
Attempted path: /usr/share/obs/obs-studio/images/overflow.png
info: [pipewire] available cursor modes:
info: [pipewire]     - Metadata
info: [pipewire]     - Always visible
info: [pipewire]     - Hidden
info: PipeWire initialized (sender name: 1_275)
info: User added source 'Screen Capture (PipeWire)' (pipewire-desktop-capture-source) to scene 'Scene'
info: [pipewire] screencast session created
info: [pipewire] asking for desktop…
info: [pipewire] desktop selected, setting up screencast
info: [pipewire] created stream 0x55fdd9639900
info: [pipewire] playing stream…
info: ---------------------------------
info: [x264 encoder: 'simple_h264_recording'] preset: veryfast
info: [x264 encoder: 'simple_h264_recording'] profile: high
info: [x264 encoder: 'simple_h264_recording'] settings:
    rate_control: CRF
    bitrate:      0
    buffer size:  0
    crf:          21
    fps_num:      30
    fps_den:      1
    width:        1280
    height:       720
    keyint:       250

info: libfdk_aac encoder created
info: libfdk_aac bitrate: 192, channels: 2
info: ==== Recording Start ===============================================
info: [ffmpeg muxer: 'simple_file_output'] Writing file '/home/archerallstars/snap/obs-studio/1284/2022-08-18 19-26-52.mp4'...
info: Output format name and long_name: mp4, MP4 (MPEG-4 Part 14)
warning: Failed to create xdg-screensaver: 2
info: [ffmpeg muxer: 'simple_file_output'] Output of file '/home/archerallstars/snap/obs-studio/1284/2022-08-18 19-26-52.mp4' stopped
info: Output 'simple_file_output': stopping
info: Output 'simple_file_output': Total frames output: 1535
info: Output 'simple_file_output': Total drawn frames: 1561 (1563 attempted)
info: Output 'simple_file_output': Number of lagged frames due to rendering lag/stalls: 2 (0.1%)
info: ==== Recording Stop ================================================
info: libfdk_aac encoder destroyed
info: ==== Shutting down ==================================================
info: pulse-input: Stopped recording from 'bluez_output.74_45_CE_B2_5D_F6.headset-head-unit.monitor'
info: pulse-input: Got 7004 packets with 2801600 frames
info: pulse-input: Stopped recording from 'bluez_input.74_45_CE_B2_5D_F6.headset-head-unit'
info: pulse-input: Got 7011 packets with 2804400 frames
info: All scene data cleared
info: ------------------------------------------------
[2022-08-18 19:28:07] [info] asio handle_accept error: asio.system:125 (Operation aborted.)
[2022-08-18 19:28:07] [info] Error getting remote endpoint: asio.system:9 (Bad file descriptor)
[2022-08-18 19:28:07] [fail] WebSocket Connection Unknown - "" - 0 asio.system:125 Operation aborted.
[2022-08-18 19:28:07] [info] asio async_shutdown error: asio.system:9 (Bad file descriptor)
[2022-08-18 19:28:07] [error] handle_accept error: Operation aborted.
[2022-08-18 19:28:07] [info] Stopping acceptance of new connections because the underlying transport is no longer listening.
info: [obs-websocket] IO thread exited.
info: [obs-websocket] server stopped successfully
info: [adv-ss] stopped
info: [adv-ss] trying to reconnect to  in 10 seconds.
info: [adv-ss] trying to reconnect to  in 10 seconds.
info: [obs-websocket] goodbye!
info: [obs-vnc] plugin unloaded
info: [obs-ndi] goodbye !
info: [obs-backgroundremoval] plugin unloaded
info: [obs-audio-pan-filter] plugin unloaded
info: [linux-vkcapture] plugin unloaded
info: [Scripting] Total detached callbacks: 0
info: [StreamFX] Unloading Version 0.11.0.0c1-g2d7fce5a
info: [StreamFX] <gfx::opengl> Finalized.
info: [StreamFX] Unloaded Version 0.11.0.0c1-g2d7fce5a
info: Freeing OBS context data
info: == Profiler Results =============================
info: run_program_init: 3984.03 ms
info:  ┣OBSApp::AppInit: 5.593 ms
info:  ┃ ┗OBSApp::InitLocale: 2.028 ms
info:  ┗OBSApp::OBSInit: 3866.91 ms
info:    ┣obs_startup: 0.684 ms
info:    ┗OBSBasic::OBSInit: 3747.91 ms
info:      ┣OBSBasic::InitBasicConfig: 0.126 ms
info:      ┣OBSBasic::ResetAudio: 0.196 ms
info:      ┣OBSBasic::ResetVideo: 67.858 ms
info:      ┣OBSBasic::InitOBSCallbacks: 0.008 ms
info:      ┣OBSBasic::InitHotkeys: 0.046 ms
info:      ┣obs_load_all_modules: 530.618 ms
info:      ┃ ┣obs_init_module(StreamFX.so): 16.628 ms
info:      ┃ ┣obs_init_module(advanced-scene-switcher.so): 5.172 ms
info:      ┃ ┣obs_init_module(decklink-captions.so): 0.083 ms
info:      ┃ ┣obs_init_module(decklink-ouput-ui.so): 1.469 ms
info:      ┃ ┣obs_init_module(dir-watch-media.so): 0.006 ms
info:      ┃ ┣obs_init_module(downstream-keyer.so): 13.145 ms
info:      ┃ ┣obs_init_module(dvd-screensaver.so): 0.007 ms
info:      ┃ ┣obs_init_module(dynamic-delay.so): 0.005 ms
info:      ┃ ┣obs_init_module(freeze-filter.so): 0.078 ms
info:      ┃ ┣obs_init_module(frontend-tools.so): 124.46 ms
info:      ┃ ┣obs_init_module(gradient-source.so): 0.072 ms
info:      ┃ ┣obs_init_module(image-source.so): 0.012 ms
info:      ┃ ┣obs_init_module(liblooking-glass-obs.so): 0.022 ms
info:      ┃ ┣obs_init_module(libtext-pango.so): 8.957 ms
info:      ┃ ┣obs_init_module(linux-alsa.so): 0.004 ms
info:      ┃ ┣obs_init_module(linux-capture.so): 2.771 ms
info:      ┃ ┣obs_init_module(linux-decklink.so): 0.366 ms
info:      ┃ ┣obs_init_module(linux-jack.so): 0.005 ms
info:      ┃ ┣obs_init_module(linux-pulseaudio.so): 0.003 ms
info:      ┃ ┣obs_init_module(linux-v4l2.so): 0.223 ms
info:      ┃ ┣obs_init_module(linux-vkcapture.so): 0.096 ms
info:      ┃ ┣obs_init_module(move-transition.so): 0.032 ms
info:      ┃ ┣obs_init_module(nvfbc.so): 0.15 ms
info:      ┃ ┣obs_init_module(obs-audio-pan-filter.so): 0.035 ms
info:      ┃ ┣obs_init_module(obs-backgroundremoval.so): 0.029 ms
info:      ┃ ┣obs_init_module(obs-browser.so): 0.066 ms
info:      ┃ ┣obs_init_module(obs-ffmpeg.so): 0.328 ms
info:      ┃ ┃ ┗nvenc_check: 0.214 ms
info:      ┃ ┣obs_init_module(obs-filters.so): 0.028 ms
info:      ┃ ┣obs_init_module(obs-gphoto.so): 0.007 ms
info:      ┃ ┣obs_init_module(obs-gstreamer.so): 6.509 ms
info:      ┃ ┣obs_init_module(obs-libfdk.so): 0.026 ms
info:      ┃ ┣obs_init_module(obs-ndi.so): 64.766 ms
info:      ┃ ┣obs_init_module(obs-outputs.so): 0.004 ms
info:      ┃ ┣obs_init_module(obs-rgb-levels-filter.so): 0.005 ms
info:      ┃ ┣obs_init_module(obs-rtspserver.so): 60.72 ms
info:      ┃ ┣obs_init_module(obs-transitions.so): 0.014 ms
info:      ┃ ┣obs_init_module(obs-vnc.so): 0.035 ms
info:      ┃ ┣obs_init_module(obs-vst.so): 0.011 ms
info:      ┃ ┣obs_init_module(obs-websocket.so): 5.239 ms
info:      ┃ ┣obs_init_module(obs-x264.so): 0.077 ms
info:      ┃ ┣obs_init_module(recursion-effect.so): 0.008 ms
info:      ┃ ┣obs_init_module(replay-source.so): 0.062 ms
info:      ┃ ┣obs_init_module(rtmp-services.so): 0.88 ms
info:      ┃ ┣obs_init_module(scale-to-sound.so): 0.009 ms
info:      ┃ ┣obs_init_module(sndio.so): 0.007 ms
info:      ┃ ┣obs_init_module(source-copy.so): 0.324 ms
info:      ┃ ┣obs_init_module(source-record.so): 0.057 ms
info:      ┃ ┣obs_init_module(source-switcher.so): 0.058 ms
info:      ┃ ┣obs_init_module(spectralizer.so): 0.039 ms
info:      ┃ ┣obs_init_module(text-freetype2.so): 0.014 ms
info:      ┃ ┣obs_init_module(time-warp-scan.so): 0.028 ms
info:      ┃ ┣obs_init_module(transition-table.so): 0.089 ms
info:      ┃ ┗obs_init_module(vlc-video.so): 1.375 ms
info:      ┣OBSBasic::ResetOutputs: 3.852 ms
info:      ┣OBSBasic::CreateHotkeys: 0.064 ms
info:      ┣OBSBasic::InitService: 1.25 ms
info:      ┣OBSBasic::InitPrimitives: 0.313 ms
info:      ┗OBSBasic::Load: 3075.88 ms
info: obs_hotkey_thread(25 ms): min=0.001 ms, median=0.002 ms, max=0.259 ms, 99th percentile=0.007 ms, 100% below 25 ms
info: audio_thread(Audio): min=0 ms, median=0.292 ms, max=129.969 ms, 99th percentile=1.703 ms
info:  ┗receive_audio: min=0.005 ms, median=0.222 ms, max=129.776 ms, 99th percentile=0.673 ms, 0.298865 calls per parent call
info:    ┣buffer_audio: min=0 ms, median=0.001 ms, max=0.106 ms, 99th percentile=0.008 ms
info:    ┗do_encode: min=0.065 ms, median=0.214 ms, max=129.768 ms, 99th percentile=0.657 ms
info:      ┣encode(simple_aac_recording): min=0.063 ms, median=0.196 ms, max=1.456 ms, 99th percentile=0.592 ms
info:      ┗send_packet: min=0.001 ms, median=0.011 ms, max=129.584 ms, 99th percentile=0.095 ms
info: obs_graphics_thread(33.3333 ms): min=0.042 ms, median=3.519 ms, max=2973.09 ms, 99th percentile=19.026 ms, 99.788% below 33.333 ms
info:  ┣tick_sources: min=0 ms, median=0.027 ms, max=2972.85 ms, 99th percentile=0.081 ms
info:  ┣output_frame: min=0.021 ms, median=1.935 ms, max=85.584 ms, 99th percentile=12.741 ms
info:  ┃ ┣gs_context(video->graphics): min=0.021 ms, median=1.934 ms, max=79.972 ms, 99th percentile=12.033 ms
info:  ┃ ┃ ┣render_video: min=0.012 ms, median=1.67 ms, max=79.906 ms, 99th percentile=11.873 ms
info:  ┃ ┃ ┃ ┣render_main_texture: min=0.01 ms, median=0.863 ms, max=72.349 ms, 99th percentile=3.245 ms
info:  ┃ ┃ ┃ ┣render_output_texture: min=0.036 ms, median=0.087 ms, max=3.393 ms, 99th percentile=0.31 ms, 0.301407 calls per parent call
info:  ┃ ┃ ┃ ┣render_convert_texture: min=0.034 ms, median=0.081 ms, max=2.506 ms, 99th percentile=0.302 ms, 0.301407 calls per parent call
info:  ┃ ┃ ┃ ┗stage_output_texture: min=3.386 ms, median=6 ms, max=24.997 ms, 99th percentile=15.147 ms, 0.301407 calls per parent call
info:  ┃ ┃ ┣gs_flush: min=0 ms, median=0.115 ms, max=2.12 ms, 99th percentile=0.454 ms
info:  ┃ ┃ ┗download_frame: min=0 ms, median=0.014 ms, max=0.31 ms, 99th percentile=0.051 ms, 0.301407 calls per parent call
info:  ┃ ┗output_video_data: min=0.153 ms, median=0.251 ms, max=7.633 ms, 99th percentile=1.938 ms, 0.301214 calls per parent call
info:  ┗render_displays: min=0.004 ms, median=0.864 ms, max=53.662 ms, 99th percentile=5.284 ms
info: video_thread(video): min=0 ms, median=1.888 ms, max=142.827 ms, 99th percentile=7.056 ms
info:  ┗receive_video: min=0.786 ms, median=1.883 ms, max=142.822 ms, 99th percentile=6.602 ms
info:    ┗do_encode: min=0.785 ms, median=1.88 ms, max=142.817 ms, 99th percentile=6.599 ms
info:      ┣encode(simple_h264_recording): min=0.767 ms, median=1.815 ms, max=107.992 ms, 99th percentile=6.028 ms
info:      ┗send_packet: min=0.007 ms, median=0.026 ms, max=140.392 ms, 99th percentile=0.232 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: obs_hotkey_thread(25 ms): min=25.023 ms, median=25.106 ms, max=34.496 ms, 99.2155% within ±2% of 25 ms (0% lower, 0.784482% higher)
info: obs_graphics_thread(33.3333 ms): min=0.073 ms, median=33.333 ms, max=2973.11 ms, 98.9977% within ±2% of 33.333 ms (0.520432% lower, 0.481881% higher)
info: =================================================
info: Number of memory leaks: 15
archerallstars commented 1 year ago

I tried launching my local gphoto2 with:

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 2 -f v4l2 /dev/video13 

There's no memory leak at all.

Note: my dummy video device is at /dev/video13 which I checked it by v4l2-ctl --list-devices. I can use my camera through gphoto2 directly. But I would prefer using it through OBS which would provide a lot more options.

lucyllewy commented 1 year ago

The memory leaks message is output by OBS. I doubt it is specific to the gphoto plugin, tho I cannot be 100% certain. It is also unlikely to be specific to the Snap Packaged release of OBS (https://github.com/obsproject/obs-studio/blob/f5be6f5fdd2fe34b18518ecd38030f0768845688/UI/obs-app.cpp#L3068)

Is it possible for you to check a non-snapped version of OBS with the gphoto plugin to see if it occurs only with the Snap Package? If it is reproducible with a copy of OBS that isn't from the Snap Package then you have two options below for further steps:

If it is an issue that is specific to the Snap Package then we can look into further diagnostics to attempt to narrow down why the Snap is different.

flexiondotorg commented 8 months ago

Closed via #172, which removes the gPhoto plugin.