juhovh / shairplay

Apple airplay and raop protocol server
Other
1.34k stars 226 forks source link

Error opening audio device 5 #72

Open fsevenm opened 6 years ago

fsevenm commented 6 years ago

Below is the complete error

Error opening audio device 5 Please check your libao settings and try again

It tells me to check my libao settings, but I think there is no problem with them. This is my libao settings in /etc/libao.conf

default_driver=pulse quiet

Any solutions will be appreciated.

erikhric commented 5 years ago

Try running as sudo. I saved me on nxp dev board. Double check the driver - if you are using alsa device, you should change the confing accordingly.

frol commented 5 years ago

I am getting the same error:

$ sudo shairplay -a mylaptop
Error opening audio device 5
Please check your libao settings and try again

I have tried alsa and pulse as a default_driver in /etc/libao.conf. Here is the default /etc/libao.conf config in my Arch Linux:

default_driver=alsa
dev=default
quiet

If I drop quiet setting, and keep alsa, I get:

ao_alsa ERROR: Unable to open ALSA device 'default' for playback => Invalid argument

which seems fine as I use pulseaudio. With debug setting and pulse driver I get:

debug: Loaded driver null (built-in)
debug: Loaded driver wav (built-in)
debug: Loaded driver raw (built-in)
debug: Loaded driver au (built-in)
debug: Loading driver plugins from /usr/lib/ao/plugins-4...
debug: Loaded driver pulse
debug: Loaded driver alsa
debug: Loaded driver oss
debug: Testing drivers to find playback default...
Error opening audio device 5
Please check your libao settings and try again
ColonelThirtyTwo commented 4 years ago

Getting the same issue on a fresh Arch Linux install. Not really sure how this app in general is supposed to work.

stephensrmmartin commented 4 years ago

Edit your /etc/libao.conf:

  1. Change default_driver to pulse
  2. Comment out dev=default
sagar-connect commented 4 years ago

Edit your /etc/libao.conf:

  1. Change default_driver to pulse
  2. Comment out dev=default

Getting the same error, on Ubuntu. Here's my /etc/libao.conf

default_driver=pulse
quiet

I don't even care about the audio for the moment, just need an extended screen with my Mac, is there a way?

bikubi commented 4 years ago

same here, on Arch.

@rashsaga - I was to start it with dev=null in libao.conf and --ao_driver=alsa

HugoPoi commented 4 years ago

I think we can close this one, because I confirm it's working on ArchLinux with just this

default_driver=pulse
quiet

in the /etc/libao.conf

UnlimitedCookies commented 3 years ago

Why is alsa not supported though?

HugoPoi commented 3 years ago

@UnlimitedCookies I think alsa is supported, it's just a mess if you use pulse and the same time alsa

lunasophia commented 1 month ago

I think we can close this one, because I confirm it's working on ArchLinux with just this

default_driver=pulse
quiet

in the /etc/libao.conf

This does not work for me on Arch. Maybe it did in 2020 when this comment was written, maybe HugoPoi has a different setup than I do (I have several different audio devices on my system). Confusingly, if I try to specify a different device ID, the option seems to be ignored:

$ doas /usr/bin/shairplay -a myhostname --ao_deviceid=2
Error opening audio device 5
Please check your libao settings and try again

Digging into the code, I see why. https://github.com/juhovh/shairplay/blob/096b61ad14c90169f438e690d096e3fcf87e504e/src/shairplay.c#L338 This error message isn't saying that we failed to open audio device ID 5, it's saying we failed to open the specified audio device because of error 5. This is quite counterintuitive and is why proper punctuation is so important. Following the code, we ultimately call ao_open_live in audio_open_device: https://github.com/juhovh/shairplay/blob/096b61ad14c90169f438e690d096e3fcf87e504e/src/shairplay.c#L152

Looking at the documentation for the ao_open_live function we see it can set errno to a few values. The value of 5 corresponds to AO_EOPENDEVICE, a generic "welp something went wrong lol" error.

I tried specifying debug in my libao.conf but this didn't provide any useful information. This is as much as I have time to troubleshoot right now, perhaps someone else can use the info I posted here to figure out the root cause of the problem.