Alsa error code -16 in moonlight

Hi.
Sometimes, moonlight refuses to start and this is caused by this error:

Starting audio stream...Alsa error code -16

I’ve used strace and noticed this difference when moonlight refuses to start:

openat(AT_FDCWD, "/dev/snd/pcmC0D2p", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EBUSY (Device or resource busy)

When it works correctly, strace shows the following:

openat(AT_FDCWD, "/dev/snd/pcmC0D2p", O_RDWR|O_NONBLOCK|O_CLOEXEC) = 28

Is there anything to initialize/reset with regards to the audio device?
Thanks for your help.

You just have to wait for Kodi to release the device. Make sure keep device alive is off.

1 Like

Do you stop Kodi when you launch Moonlight?
How have you installed Moonlight on the device?

I wonder if there should be some watchdog that handles the two services. You don’t really want Kodi touching the audio sink as @grahamh says and even a toast from Kodi due to some event could cause problems.

That might be the issue indeed.
I disabled this setting.
For now, I haven’t got any problem starting moonlight.

2 Likes