dimtpap / obs-pipewire-audio-capture

🔊 Audio device and application capture for OBS Studio using PipeWire
https://obsproject.com/forum/resources/pipewire-audio-capture.1458/
GNU General Public License v2.0
298 stars 9 forks source link

Audio cutouts and auto changing of audio devices when hovering over taskbar icons of KDE Plasma #53

Closed RiQuY closed 3 months ago

RiQuY commented 3 months ago

Description

Audio cutouts and auto changing of audio devices occurs when hovering over taskbar icons of KDE Plasma, showing popups like the screenshots below, the behavior also happens without audio sources from the plugin added to OBS.

image

image

The popups indicate auto changing audio devices and the following message: "Can't find input or output devices".

Reproduction

  1. Build/install the plugin.
  2. Open OBS, open Discord and enter a voice channel.
  3. Try adding some audio sources from this plugin, for example 1 for a game and 1 for Discord.
  4. Interact with Discord app (Webcord in my case) like talking, muting, unmuting until you hear a audio device change.
  5. Start hovering the mouse in the icons of the KDE taskbar and the audio cutouts and auto device changes will occur.

This behavior stops hapenning when both OBS and Discord are closed, this is not 100% reproductible it happens at random.

I can't record a video showing this because the video can't capture the pipewire popups (the screenshots attached).

Workaround

Closing Discord before using OBS.

System info

libpipewire 1.0.3 OBS Studio: 29.1.3 (Not Flatpak) obs-pipewire-audio-capture: master branch - commit 7dbe3ba

OS: openSUSE Tumbleweed x86_64 Kernel: 6.7.7-1-default DE: Plasma 5.27.10 WM: kwin Theme: [Plasma], Breeze-Dark [GTK2/3] Icons: [Plasma], breeze-dark [GTK2/3] CPU: AMD Ryzen 7 1700X (16) @ 3.400GHz GPU: AMD ATI Radeon RX 5600 OEM/5600 XT / 5700/5700 XT Memory: 6921MiB / 32016MiB

dimtpap commented 3 months ago

Exact same problems and cause:
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3070 https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3055

I've experienced this myself (also on KDE Plasma) but it's not that bad anymore. Consider using a higher quantum https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#setting-buffer-size-quantum

RiQuY commented 3 months ago

@dimtpap Can you share the config you used to avoid the issue? I don't think the issue should be marked as complete if you are experiencing it too but thanks for explaining the cause.

RiQuY commented 3 months ago

Exact same problems and cause: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3070 https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3055

I've experienced this myself (also on KDE Plasma) but it's not that bad anymore. Consider using a higher quantum https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#setting-buffer-size-quantum

Do I need to increase the default quantum, the min or max value?

dimtpap commented 3 months ago

Can you share the config you used to avoid the issue?

I'm using the default PipeWire config

I don't think the issue should be marked as complete if you are experiencing it

I was experiencing it but it's been fixed by a PipeWire update a while ago. I closed the issue because it's a problem that's been reported before to PipeWire upstream and was unrelated to the plugin. Also,

the behavior also happens without audio sources from the plugin added to OBS

It's very unlikely then for this to be causing problems. If you're using the PipeWire sources to capture your screen then there may be a problem there.

If you can only reproduce the problem with the plugin sources being used then it's more likely to be a problem specific to the plugin and this should be reopened. Try with no PipeWire sources, try with OBS's JACK sources, try other JACK applications, etc.

RiQuY commented 3 months ago

The thing is that I only started experiencing this issue after installing the plugin. Before that I have never had that issue.

To be clear, the problem happens with pipewire audio sources from this plugin added, and even after removing the pipewire audio sources from OBS the problem will persists until OBS is closed. When creating the issue I thought it was discord fault but it happens at random.

It doesn't happen right when adding the audio sources to OBS, yesterday I was streaming and the problem started occurring after 1 hour and as long I don't touch the kde bar the audio will work fine without showing an audio device change, the issue of device changing only occurs when touching the KDE taskbar and if you move your mouse out of it the problem will stop until you hover the mouse over the taskbar again.

If you tell me how I can provide you with logs or any debug info to help I'll be glad to, I built the project from source to use it.

dimtpap commented 3 months ago

First, try to see if the issue happens with other PipeWire stuff. Does it trigger when using only Screen/Window Capture (PipeWire) sources? Does it happen when using JACK Input sources (these need to be routed using a program like qpwgraph)?

It may be a problem with your system or a regression with PipeWire or something else. Since the same problem has been reported in the past, to PipeWire, it's unclear what's really the cause here. If you can narrow it down to this plugin then we can look into it more.

RiQuY commented 2 months ago

@dimtpap After trying several configurations in pipewire the audio device changes stopped by setting default.clock.max-quantum = 2048 in pipewire config but I then some audio crackling started happening every second, this crackling is not audible in en stream or recording, can be listened only in my headphones, currently connected to the front jack of my PC. I changed back the quantum to 1024 and the cracking is still happening.

If I restart pipewire with OBS opened the crackling stops because the pipewire audio plugin sources lost the audio, but if I restart OBS the cracking begins again. I cant share error logs because these are not program crashes or something similar, only audio distortions not logged in journalctl.

Did you have similar issues or any tips on how to solve this? I think this is related to obs-pipewire-audio-capture plugin because it only happens when OBS is open and the pipewire sources of the plugin have active audio, the crackling become more frequent when I'm recording or streaming too.

Thanks.

RiQuY commented 2 months ago

After trying an insane amount of configuration options in PipeWire and OBS, like trying to reduce the audio sources added with this plugin in OBS and even changing the connector and the cable of my headset, the only solution I found to the audio cracking is stop using this plugin and use the default audio output of OBS from a single source.

I wish you good luck with the project but for me is it not usable in it's current state.