Main thread panicks when sound device unavailable
Opened this issue · 1 comments
Using:
./librespot -n SpotifyMain -b 320 --backend portaudio --device "NAD USB Audio 2.0: - (hw:2,0)"
commit eb49ff3 on Ubuntu 16.04
If the hardware is claimed by other software (or hardware not available) and spotify connect attempts to load a song, the main thread panicks & fails.
Suggestion is to make it fail gracefully and wait for the next command?
When started correctly and while paused, another program claims the soundcard:
INFO:librespot::player: Track "The Old Man Down The Road" loaded
INFO:librespot::player: Loading track "The Old Man Down The Road"
INFO:librespot::player: Track "The Old Man Down The Road" loaded
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904
Expression 'PaAlsaStreamComponent_Initialize( &self->playback, alsaApi, outParams, StreamDirection_Out, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2175
Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840
thread '' panicked at 'calledResult::unwrap()
on anErr
value: Device unavailable', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:868
note: Run withRUST_BACKTRACE=1
for a backtrace.
thread 'main' panicked at 'calledResult::unwrap()
on anErr
value: "SendError(..)"', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:868
on another occasion, starting librespot while device already claimed:
thread '' panicked at 'Could not find device', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/option.rs:715
note: Run withRUST_BACKTRACE=1
for a backtrace.
Same issue here.. I run librespot in conjunction with snapcast, so I don't even use an audiodevice.