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
299 stars 9 forks source link

Changing output device breaks the capture #2

Closed cybik closed 2 years ago

cybik commented 2 years ago

Issue

When a PipeWire source pointing to an application is added and there's audio playing, the incoming sink is fine. But if I change the output device using a control app like pavucontrol, your PipeWire plugin loses the feed.

Workaround

Removing the audio source and adding it again forces your plugin to "refresh" the source, and it comes back

Why did you write this

I actually wanted a per-app plugin for the longest time. THANK YOU for making it!

(edited to clarify)

dimtpap commented 2 years ago

If I undestood correctly, you're using an output capture set to "Default" right? That option just says to PipeWire "hey just connect me to whatever you want" when connecting at first, afterwards nothing takes care of tracking the default devices.

I'm not sure if there are other ways to get info about default devices from PipeWire, there probably are though, I'll have to look into it more.

cybik commented 2 years ago

In OBS I had a Pipewire source set to the application I wanted to capture. I then changed the output device for the app via pavucontrol, and then your plugin "lost" the source feed.

dimtpap commented 2 years ago

In OBS I had a Pipewire source set to the application I wanted to capture. I then changed the output device for the app via pavucontrol, and then your plugin "lost" the source feed.

Oh, I see. I'll have a look. Thanks for reporting!

cybik commented 2 years ago

My pleasure! Also edited the initial report for clarity :+1:

cybik commented 2 years ago

I'm probably talking out of my proverbial backside here, but: pw_stream_add_listener could be of help here? `if there's an event, auto-reconnect" or something. with any luck it's fast enough.

Though this could also be something to report upstream.

dimtpap commented 2 years ago

I'm unable to reproduce the issue, are you using pipewire-media-session or wireplumber?

Edit: I switched to pipewire-media-session and I got the issue you were describing so I'm assuming there's a problem there

cybik commented 2 years ago

Ah, fair. I am using pavucontrol to switch the output device, so the behaviour being triggered by pipewire-media-session makes sense!

dimtpap commented 2 years ago

Looks like the problem is with pipewire-media-session then? You can either switch to WirePlumber or, although not optimal, try Helvum for changing the output of applications