janbar / noson-app

The essential to control music from your SONOS devices on Linux platforms
GNU General Public License v3.0
340 stars 28 forks source link

Cannot connect to pipewire #175

Closed AntonOellerer closed 2 years ago

AntonOellerer commented 2 years ago

Hey, First of all, thank you for this nice project! I am currently running into issues when trying to use noson for streaming sound from my laptop via pipewire. When I activate the PulseAudio button, the UI changes, but the sink does not show up in the sound control gui, and journalctl shows me the following messages:

Feb 02 12:08:43 fedora io.github.janbar.noson.desktop[1357889]: (SONOS)streamSink: no sink availableqml: Set queue position view at -1
Feb 02 12:08:43 fedora wireplumber[1295353]: <WpSiAudioAdapter:0x55d899e67610> Object activation aborted: proxy destroyed
Feb 02 12:08:43 fedora wireplumber[1295353]: <WpSiAudioAdapter:0x55d899e67610> failed to activate item: Object activation aborted: proxy destroyed

Do you know what the problem is here? I already looked through https://github.com/janbar/noson-app/issues/159, but I did not really find concluding information there.

Best regards Anton

janbar commented 2 years ago

I have no clue about "pipewire". The app use the standard API of pulseaudio to create its sink. Seems "pipewire" isn't fully compatible with pulseaudio.

janbar commented 2 years ago

If you know C/C++ , you could try to hack the source code to investigate what happen with pipewire. the corresponding source code is here: https://github.com/janbar/noson/blob/master/noson/src/pacontrol.cpp (libnoson). The debug message you gotten is here: https://github.com/janbar/noson/blob/4b72e18d5b7a28a7dc878f3bce1793468149c016/noson/src/pulsestreamer.cpp#L190

The normal debug output should be:


(SONOS)newSink: create succeeded (32)
(SONOS)GetPASink: Found device 47: noson.monitor
(SONOS)Open FLAC encoder
(SONOS)FLAC encoder wrote 4 bytes, 0 samples, 0 frame
(SONOS)FLAC encoder wrote 38 bytes, 0 samples, 0 frame
(SONOS)FLAC encoder wrote 44 bytes, 0 samples, 0 frame
(SONOS)Open PA session
(SONOS)FLAC encoder wrote 535 bytes, 4096 samples, 0 frame
(SONOS)FLAC encoder wrote 535 bytes, 4096 samples, 1 frame```
AntonOellerer commented 2 years ago

Thanks for the tip, I will take a look at it when I have some time!

janbar commented 2 years ago

@AntonOellerer , I succeeded make it work with pipewire. Let me little more time to understand what's happen ... Using pipewire, retrieving list of available sink need to wait some time (500ms) to return the nonson.monitor sink. I have to manage a timeout.

janbar commented 2 years ago

I fixed the issue by the commit https://github.com/janbar/noson/commit/b4fb89bc4a3904ac556e4dc12a4ed6398efb27a3. The new release 5.0.5 include the fix.

janbar commented 2 years ago

Seems there is an issue with the package flatpak: libpulse.so cannot be loaded at startup due to a leak in runtime env. I will try to resolve it, but it could not be soon because those packaging i.e flatpak, snap ... are always a mess.

So please prefer NATIVE build or the package from my PPA (ubuntu), or the AppImage provided in releases section.

AntonOellerer commented 2 years ago

Hey, I have only been able to run a quick test now with the flatpak package, but I was able to redirect the audio to the noson sink, and consequently to the sonos speaker, so it seems to work now, thank you very much! If you are interested, I can inspect it more thoroughly and/or with the package built version.

janbar commented 2 years ago

Yep, I found the issue in the flatpak package. The resolver did'nt find the lib libpulse.so. Instead I have to load the lib libpulse.so.0. So now it should work as expected. Thanks reporting this issue, and let me know if you face an other bug.

AntonOellerer commented 2 years ago

Thank you a log :pray: