moonlight-embedded icon indicating copy to clipboard operation
moonlight-embedded copied to clipboard

Alsa buffer underrun - workaround/feature request

Open royka1 opened this issue 4 years ago • 3 comments

I'm using moonlight with a Asus Tinker Board (armbian), every 20 minutes or so I get Alsa error's. I've tried a lot of things to avoid the buffer underrun, but can't solve the problem, however I've found a workaround. When there is a buffer underrun with Alsa, moonlight won't recover so you have to restart the whole stream, this I find quite anoying. Now I start moonlight with the -local audio option and start a "scream" stream for the audio. https://github.com/duncanthrax/scream

With scream I also get some buffer underruns (about 5 in 2hrs), but it recovers from it, so you only notice a loss of audio then.

Is it possible to code moonlight this way?

royka1 avatar Jun 22 '21 10:06 royka1

Why not using pulseaudio on top of alsa ? Buffer underruns are gone with it

AreaScout avatar Jul 22 '21 08:07 AreaScout

Why not using pulseaudio on top of alsa ? Buffer underruns are gone with it

Tried that, but I had still Alsa errors, but instead Writei -2 I had Writei -11 if I remember correctly. And instead that the whole stream stopped, only the audio stopped. After that I've tried PipeWire, then the audio kept working, but at the moment it would normally stop, the audio was distorted. Playing with the buffer length didn't make a difference

royka1 avatar Jul 22 '21 17:07 royka1

Those Writei -11 errors only happen with ALSA iirc, you have to build moonlight with pulseaudio support and start the daemon with pulseaudio --start

AreaScout avatar Jul 22 '21 19:07 AreaScout