plietar / librespot

Open Source Spotify client library
MIT License
1.14k stars 185 forks source link

Crashes on Raspi 3 using pulseaudio #235

Open Bebowi opened 7 years ago

Bebowi commented 7 years ago

I'm using Raspbian Jessie Release 8.0

When i'm trying to start librespot on my Raspberry Pi 3 using PulseAudio backend

RUST_BACKTRACE=1 ~/librespot/target/release/librespot --username my@email --cache /tmp/librespot --name Libre -p MySuperStrongPassword -b 320 --backend pulseaudio

it crashes with following message:

INFO:librespot_core::session: Connecting to AP "gew1-accesspoint-c-h1c1.ap.spotify.com:4070"
INFO:librespot_core::session: Authenticated as "1157689638" !
INFO:librespot_core::session: Country: "DE"
thread '<unnamed>' panicked at 'assertion failed: s != null_mut()', src/audio_backend/pulseaudio.rs:39
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
   6: <librespot::audio_backend::pulseaudio::PulseAudioSink as librespot::audio_backend::Open>::open
   7: librespot::audio_backend::mk_sink
   8: std::panicking::try::do_call
   9: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  10: <F as alloc::boxed::FnBox<A>>::call_box
  11: std::sys::imp::thread::Thread::new::thread_start
             at /checkout/src/liballoc/boxed.rs:650
             at /checkout/src/libstd/sys_common/thread.rs:21
             at /checkout/src/libstd/sys/unix/thread.rs:84 

It works fine on my ubuntu VM, so I thought it is caused by the version of Pulseaudio. After an Update to Pulseaudio 10.0 the same issue occours.

I want to use Pulseaudio for several reasons:

  1. With Portaudio write underflow occours from time to time
  2. I want to do some further work in network

Any Ideas what is wrong on my Raspberry?

TurokO8A commented 7 years ago

Hi, I've had the same issue for a while on my RPi3, Jessie 8.0 as well. Got a crash on connection from the Spotify client and it seemed to be related to pulseaudio. I deleted my cloned repo folder and re-cloned it with git clone https://github.com/plietar/librespot.git and then rebuilt. That got it running for the first time in a while. However, I still see the same errors involving pulseaudio, so I'm not claiming victory just yet (as it also seems nothing like a permanent solution). So, This is what I got:

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
INFO:librespot::player: Loading track "Landed On La Luna"
INFO:librespot::player: Track "Landed On La Luna" loaded

I'll update if it crashes again. Good Luck!

Bebowi commented 7 years ago

@TurokO8A You don't use pulesaudio as backend. What you are discribing is a normal start using stadard backend (Portaudio).

Any ideas regarding my error?

haslersn commented 5 years ago

Any ideas regarding my error?

You have to run PulseAudio and librespot with the same user.