FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

Stopping audio when using PipeWire completely desyncs audio from video and glitches audio out when it resumes #127

Closed drazil100 closed 1 year ago

drazil100 commented 1 year ago

I switched to using PipeWire recently and ever since I have had an EXTREMELY annoying issue that makes UxPlay pretty much completely unusable. Any time I switch apps or there is a pause in the music within an app it completely breaks audio.

Here is a video of what it is doing: https://youtu.be/BeI1MQwQ4xg

I recognize this is probably something that should be addressed on the PipeWire side of things however in the event it can be addressed on this end I wanted to bring it to your attention.

fduncanh commented 1 year ago

I would need somthin reproducible to see if there is a prblem.

I have an installation of ubuntu-22.04 on x86_64 with pipewire.

using "uxplay -as pipewiresink " seems to work OK. can you provide an example that can reliably demonstrate your issue? Or describe it better. (what is uxplay running on?, for example)

drazil100 commented 1 year ago

I didn't know about -as pipewiresink. I will try that when I get home and see if that makes a difference. If not I will get you my system information. Any specific commands you wish to see the output of? (I'm on manjaro by the way)

drazil100 commented 1 year ago

ok -as pipewiresink seems to work better but the audio performance is terrible. It stutters endlessly and feels like it is being played at half speed. My system is old so that probably isn't helping at all with this.

drazil100 commented 1 year ago

Video: https://youtube.com/shorts/vgES3oMGSEo

fduncanh commented 1 year ago

switch back to pulse audio, at least temporarily, to see if uxplay works for you with pulse.

I have a current manjaro test system kernel 5.15.60-MANJARO #1 SMP PREEMPT, uxplay is working perfectly with pulseaudio. I'll switch it to pipewire to test.

OK I did that. pacman -Syu manjaro-pipewire uninstalled pulseaudio and installed pipewire

  1. uxplay -as pipewiresink produces no sound at all
  2. uxplay works fine
  3. uxplay -as pulsesink works fine
  4. uxplay -as alsasink works fine

On ubuntu with pipewire installed, uxplay -as pipewiresink works fine.

Now trying to switch back. need to do pacman -Rdd pipewire-pulse in order to reinstall pulseaudio.

seems like something is wrong with the gstreamer pipewiresink plugin on manjaro.? but pipewire without -as pipewiresink is working.

fduncanh commented 1 year ago

I'll try again, to see if I get the -as pipewiresink to work on Manjaro

drazil100 commented 1 year ago

It's possible that something broke with uxplay between when I was previously using this on pulse and now but I have had the same issue in a very specific case when using chrome so I am pretty sure the problem is at least related to pipewire and that I would have no issue if I switched back to pulse.

The issue in chrome was when I was programming a page that would capture a window on my desktop and my mic and then I used qjackctl to switch which audio source it was grabbing from my mic to something else. If I disconnected the mic before connecting the something else it would desync and glitch out in the same way as the first example.

I will try some of the other -as options and see if those work.

fduncanh commented 1 year ago

I seem to have broken the sound on my majnaro setup

(It's only a test system,so its not a problem)

fduncanh commented 1 year ago

There is nothing in uxplay to break.

The sound system is a different matter....

After restoring pulseaudio and a reboot, sound is working again on my Manjaro

drazil100 commented 1 year ago

Tried with -as alsasink and things seem to be completely functional.

I suspect the issue is with and probably should be addressed on the pipewire side of things and not on the uxplay side however given that everything else on my system has 0 audio issues including every other web page I visit on chrome and that the only issues I had were with my funky javascript tool and uxplay I figured you would want to know it was happening.

Thanks for taking the time to look into it. If there is any system info I could provide maybe a package list or logs or something I am more than happy to continue helping to try to diagnose this issue. If you want to leave it at "couldn't reproduce" I completely understand.

fduncanh commented 1 year ago

weird stuff happens on computers

Seems to be pipewire on manjaro, pipewire on ubuntu was fine when I tested.

drazil100 commented 1 year ago

Weird... Good information to know! I'll let you know if alsasink gives me any issues when I go to actually use uxplay.

fduncanh commented 1 year ago

hopefully using an -as option fixes things. let us know if it doesnt!