Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Rodio as default playback backend #277

Merged
merged 11 commits into from
Mar 20, 2019

Conversation

willstott101
Copy link
Contributor

@willstott101 willstott101 commented Dec 5, 2018

Hello, I'm new to Rust and librespot but I thought this #145 would be a reasonable first thing to look-at, as a vague attempt at helping to improve the cross-platform audio ecosystem and encourage projects such as Tomahawk.

I managed to get music playing with the back-end in this state... however there's a buzz when nothing is playing and the sink (in windows at least) has to be 44100 Hz for playback to work as cpal doesn't consider resampling to be in it's remit.

So I've decided to pause here, share what I've got and consider #195

Basically, would you prefer I had at go swapping in Rodio to handle everything it can, and reduce code here in librespot as much as possible, or perhaps use another approach... such as a Rodio back-end in the current structure with the intention of slowly removing the others.

@sashahilton00
Copy link
Member

would you prefer I had at go swapping in Rodio to handle everything it can, and reduce code here in librespot as much as possible, or perhaps use another approach... such as a Rodio back-end in the current structure with the intention of slowly removing the others.

I think that is the best course of action. The less audio code we have to maintain, the better. If you want to have a go at adding Rodio support, that would be most welcome.

@willstott101 willstott101 changed the title [WIP] CPAL backend [WIP] Rodio backend Jan 20, 2019
@willstott101
Copy link
Contributor Author

So I've switched the code to use Rodio which makes it far far simpler. It now plays audio on my Windows machine regardless of the audio device's native format which is nice.

There are some pretty significant playback issues on my windows machine. The sink accepts audio without ever blocking the playback thread, and I think that might cause Librespot to just plow through songs as fast as it can download them...

I will do some more testing soon, including on other platforms.

I haven't found much time to spend on this, so I've just swapped in rodio as an optional back-end currently, rather than removing support for any of the others.

@Herbstein
Copy link

Herbstein commented Mar 7, 2019

It seems, based on the RustAudio/rodio#220 pull request, that the next step is using the len() method. Quickly looking at it, it seems modifying the Sink trait is probably the best bet. However, removing the other backends would probably be a good choice, since Rodio supersedes them, and implementing a len() function for all of them is just duplicating the work done in Rodio. At that point it can then be considered whether you even need the Sink trait, when you only have one implementation anyway.

@willstott101
Copy link
Contributor Author

willstott101 commented Mar 7, 2019

Yes I have a completely working implementation at home. I was tempted to wait till the next Rodio release to keep going. But I'll see if I can get this working with a git dependency for the time being.

The len method is only needed to provide the same functionality as the other backends. I'm using it the same way as #283 uses queue.size()

@Herbstein
Copy link

I'd personally love to see the implementation. As you can see above I referenced above, there is an ncurses Spotify client which has Windows support blocked by this.

@Herbstein
Copy link

Herbstein commented Mar 7, 2019

I just tested it, and it does work -- kinda. I don't know if I'm experiencing a bug in your implementation, or in librespot as a whole.

When I try and play a song in librespot I can see it loads in the CLI, but nothing is played. Then when I press "next song" in the Spotify client the next song is loaded and played as expected, but the Spotify client disconnects from librespot.

EDIT: It disconnects, but continues to play the queue at the time it connected.

@willstott101
Copy link
Contributor Author

willstott101 commented Mar 7, 2019 via email

@Herbstein
Copy link

I recorded a short example of what I mean.

https://gfycat.com/thunderousbrightcuckoo

It actually worked as intended the first time I tried to record it, but the second time it stopped again. Have tried a couple of times since, and it has only worked as intended that once.

I'm suspecting this isn't a bug with your code, but it's a bi-product of you enabling native Windows support.

@willstott101
Copy link
Contributor Author

I don't know if you've locally patched the default features but to run this currently I have to specify the rodio backend.

cargo run --no-default-features --features rodio-backend -- -n libre

@Herbstein
Copy link

I modified the .toml to default to the Rodio backend, so it's being used properly.

@sashahilton00
Copy link
Member

thanks for your work on this @willstott101 will give it a go later and let you know how it goes. We need to think a bit about how to handle this, as ideally rodio will become the only backend bundled with the librespot library once librespot-daemon is written, but in the meantime I have a feeling that dumping the other backends is going to break someone's workflow somewhere, and without a gauge of who is using what, it's hard to say. I think the optimal short-mid term solution might be to make sure this is working across platforms, then set rodio as the default backend, and then slowly phase the other ones out once we start introducing the daemon.

@sashahilton00
Copy link
Member

Have just tested it and it seems to be working well, thanks for the work. With regards to previous comment, I suggest you also update this PR to set rodio as the default audio backend, (and rebase it to master so that Cargo.lock files match). Also, if some people here are running on Windows, it would be great if you could build it with cargo build --no-default-features --features rodio-backend, as iirc audio backends were the primary blocker to proper windows builds, which this hopefully solves.

@sashahilton00
Copy link
Member

Managed to test this out on Windows. A bit of tweaking required to get it running (PR #293 was merged w/ this one), but built pretty easily, and sound is good. A quick vid of me testing it (loading, volume control, seeking, skipping, etc.), response times <1s, so pretty happy there. https://streamable.com/h15n1 Is there anything else in this PR that is still WIP so to speak, or should we just review what's here and get this merged?

@willstott101
Copy link
Contributor Author

willstott101 commented Mar 11, 2019 via email

@willstott101 willstott101 changed the title [WIP] Rodio backend Implement Rodio as default playback backend Mar 11, 2019
@sashahilton00
Copy link
Member

Ok, if you're happy to merge this as is, we'll get it reviewed and merged sooner rather than later. With regards to the Sink trait mentioned earlier, I'd rather not do away with that for now, as whilst the Rodio backend will ultimately become the only backend librespot is shipped with, the librespot daemon will port across all those other backends for people that wish to use them, thus the Sink trait will still serve a purpose.

playback/src/audio_backend/rodio.rs Outdated Show resolved Hide resolved
playback/src/audio_backend/rodio.rs Outdated Show resolved Hide resolved
playback/src/audio_backend/rodio.rs Show resolved Hide resolved
}

fn stop(&mut self) -> io::Result<()> {
// This will immediately stop playback, but the sink is then unusable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked too closely at rodio, but can we not use the stop method to release the sink, and the start method to capture it again? Or is it a case of once closed, it's closed until librespot is reinitialised?

Copy link
Contributor Author

@willstott101 willstott101 Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once a sink is closed it seems to set a flag in rodio that means it can't be used anymore. It's also currently the only API to immediately stop playback. The sink can be re-initialized from the rodio device... which seems to work quite well actually. It makes pausing/skipping feel much more responsive. However when using .stop() there is consistently a fuzz. I can't figure out any implementation of fn stop that doesn't cause the fuzz. Even setting the volume to 0 makes the sink go fuzzy (regardless of if it's stopped).

I suspect some digging into Rodio/CPAL is needed to get this to work. I may try to find out if the fuzz is windows specific or not tomorrow.

For reference:

    fn start(&mut self) -> io::Result<()> {
        // Really an "unpause". Doesn't undo "stop".
        // self.rodio_sink.play();

        // Will cause the existing sink to get finalized (and stop it if it
        // hasn't already... which makes a fuzz sound).
        // self.rodio_sink = rodio::Sink::new(&self.rodio_device);
        Ok(())
    }

    fn stop(&mut self) -> io::Result<()> {
        // This will immediately stop playback, but the sink is then unusable.
        // It also makes a short fuzz noise when used.
        // self.rodio_sink.stop();

        // Just garbles the output, doesn't mute it properly.
        // self.rodio_sink.set_volume(0.0);

        // This will still fuzz when it gets finalized (by being replaced in play()).
        // self.rodio_sink.pause();

        // We just have to let the current buffer play till the end.
        Ok(())
    }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean when you say fuzzy? As in it clicks when the sink is opened/closed, or switching back to librespot causes audio distortion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, I get a compile error if using that line with rodio_device from the comment above:

error[E0609]: no field `rodio_device` on type `&mut audio_backend::rodio::RodioSink`
  --> playback/src/audio_backend/rodio.rs:79:50
   |
79 |         self.rodio_sink = rodio::Sink::new(&self.rodio_device);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a windows buildable branch that reproduces the fuzz problem for me on both Ubuntu and Windows if you're curious.

I think I'll have to dig into Rodio and try some smaller examples to hunt this down. Setting the volume seems completely broken too. It would appear Sinks are not the ideal way to interact with Rodio which suprises me.

I could have a go at implementing using some lower level APIs in Rodio instead I guess... but at least the implementation in this PR functions ok as far as I know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah interesting, yeah it's whenever the stop method is called for me. So pausing does it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried on a different PC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I've tried on several PCs on both windows and ubuntu. I'll test on a macbook at some point. I've been working on a CPAL backend using the sample crate instead of using Rodio for resampling. I've managed to get that working but it's much more code. Hopefully I can use that as a learning tool to find the fuzz in upstream Rodio though.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CPAL backend using the sample crate

would this be an option for me to try to get a librespot with jack + sample rate conversion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The audio code base has changed a fair bit since 2019. Let’s let this PR be.

let default_fmt = match device.default_output_format() {
Ok(fmt) => cpal::SupportedFormat::from(fmt),
Err(e) => {
info!("Error getting default rodio::Sink format: {:?}", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be warn! instead?

let mut output_formats = match device.supported_output_formats() {
Ok(f) => f.peekable(),
Err(e) => {
info!("Error getting supported rodio::Sink formats: {:?}", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment.

@sashahilton00
Copy link
Member

Other than small formatting change above, looks good and works well for me. If someone else could also compile this and confirm whether they do or don't hear fuzzing when stop method is called, that would be great, as we can merge this if it's machine specific.

@chrisbp
Copy link

chrisbp commented Mar 17, 2019

I'm getting a panic when the rodio sink is created on an Odroid C2 using the HDMI output. The following trace is from running:

./librespot -n test --backend rodio

thread '<unnamed>' panicked at 'hardware params could not be set: "Invalid argument"', src/libcore/result.rs:997:5
stack backtrace:
   0:       0x5584e69d37 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hdf951eb9f43ea27e
                               at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1:       0x5584e658d7 - std::sys_common::backtrace::_print::h2b5fdbbb5020ccf8
                               at src/libstd/sys_common/backtrace.rs:70
   2:       0x5584e68027 - std::panicking::default_hook::{{closure}}::h18d8c59665918d69
                               at src/libstd/sys_common/backtrace.rs:58
                               at src/libstd/panicking.rs:200
   3:       0x5584e67db3 - std::panicking::default_hook::h1fd1ad969274543a
                               at src/libstd/panicking.rs:215
   4:       0x5584e687b3 - std::panicking::rust_panic_with_hook::h40a77253872948e8
                               at src/libstd/panicking.rs:478
   5:       0x5584e68363 - std::panicking::continue_panic_fmt::hec94fc8e5daf641b
                               at src/libstd/panicking.rs:385
   6:       0x5584e6826f - rust_begin_unwind
                               at src/libstd/panicking.rs:312
   7:       0x5584e7d8a3 - core::panicking::panic_fmt::h74ee8034b317ceed
                               at src/libcore/panicking.rs:85
   8:       0x5584159eaf - core::result::unwrap_failed::h9e75182c0f113eb8
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libcore/macros.rs:16
   9:       0x55841579af - <core::result::Result<T, E>>::expect::hc36a6f9793cf028f
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libcore/result.rs:825
  10:       0x5584143b4f - cpal::cpal_impl::set_hw_params_from_format::h1941f425af97b0a5
                               at /home/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/cpal-0.8.2/src/alsa/mod.rs>
  11:       0x5584143383 - cpal::cpal_impl::EventLoop::build_output_stream::h9c5305ff74190a00
                               at /home/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/cpal-0.8.2/src/alsa/mod.rs>
  12:       0x558411d76b - cpal::EventLoop::build_output_stream::h79dbe311e4e72116
                               at /home/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/cpal-0.8.2/src/lib.rs:434
  13:       0x558411c2b7 - rodio::engine::new_output_stream::h68d49072ab552f5e
                               at /home/chris/.cargo/git/checkouts/rodio-1323fe787d1dec50/8dd1187/src/engine.rs:147
  14:       0x55841128cf - rodio::engine::start::h508db44faf45a4cc
                               at /home/chris/.cargo/git/checkouts/rodio-1323fe787d1dec50/8dd1187/src/engine.rs:112
  15:       0x5584112ee7 - rodio::engine::play_raw::ha04bb7ab441f8cd1
                               at /home/chris/.cargo/git/checkouts/rodio-1323fe787d1dec50/8dd1187/src/engine.rs:51
  16:       0x55840fbfa3 - rodio::sink::Sink::new::hd325701a2e565605
                               at /home/chris/.cargo/git/checkouts/rodio-1323fe787d1dec50/8dd1187/src/sink.rs:40
  17:       0x5584106693 - <librespot_playback::audio_backend::rodio::RodioSink as librespot_playback::audio_backend::Op>
                               at playback/src/audio_backend/rodio.rs:80
  18:       0x55840df133 - librespot_playback::audio_backend::mk_sink::h7538c876d8c9c7b6
                               at playback/src/audio_backend/mod.rs:14
  19:       0x5583fc2663 - <librespot::Main as futures::future::Future>::poll::{{closure}}::h014341ca7ba53024
                               at src/main.rs:436
  20:       0x5583fb5497 - librespot_playback::player::Player::new::{{closure}}::h33fbec10fa561410
                               at /home/chris/repos/librespot/playback/src/player.rs:133
  21:       0x5583fd572b - std::sys_common::backtrace::__rust_begin_short_backtrace::h2b30fbee4aef1879
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/sys_common/backtrace.rs:135
  22:       0x5583fecdf7 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::he91294947dc3f4b1
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/thread/mod.rs:469
  23:       0x5583fc9ce7 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h1e9b1a32910>
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/panic.rs:309
  24:       0x5583fee88b - std::panicking::try::do_call::h0f29c92f3fd42820
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/panicking.rs:297
  25:       0x5584e6f4f7 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:92
  26:       0x5583fee7a7 - std::panicking::try::he73fdfffc6faab2c
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/panicking.rs:276
  27:       0x5583fc9d1f - std::panic::catch_unwind::h21f06eb5424ba8a9
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/panic.rs:388
  28:       0x5583fecc37 - std::thread::Builder::spawn_unchecked::{{closure}}::h78fc6c496ca36d02
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/thread/mod.rs:468
  29:       0x5583fece9b - <F as alloc::boxed::FnBox<A>>::call_box::h88fbbefde34d64ce
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/liballoc/boxed.rs:734
  30:       0x5584e6ec8b - std::sys::unix::thread::Thread::new::thread_start::h561dd350a6a5bdaa
                               at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/liballoc/boxed.rs:744
                               at src/libstd/sys_common/thread.rs:14
                               at src/libstd/sys/unix/thread.rs:81
  31:       0x7fa0fef56b - start_thread
  32:       0x7fa111701b - thread_start
  33:                0x0 - <unknown>

The alsa backend works ok so I'm guessing this is a rodio/cpal issue?

I have a couple of other devices I will try and get running with the rodio backend so I can test for any audio issues with the rodio-fuzz branch.

@sashahilton00
Copy link
Member

@chrisbp have you got libasound2-dev installed?

@chrisbp
Copy link

chrisbp commented Mar 17, 2019

So I got this running on an armv7 device and noticed a couple of things.

Comparing the alsa backend to the rodio one, alsa definitely feels more responsive when pausing than rodio. I assume this is because alsa is clearing its queue and stopping playback immediately, where as rodio has to wait for the queue to empty via playback.

So then I decided to try out the rodio-fuzz branch to see if the stop call helps make rodio more responsive on pause. It does indeed make it more responsive, but I get a short burst of audible junk output whenever stop is called on the sink. I decided to investigate by increasing the amount of data queued to the sink by upping the queue size check from 26 chunks to 135 chunks. With this change, the duration of the audible junk increases and begins to sound like part of the currently playing track albeit quite garbled. This is a guess, but it sounds like rodio is clearing the queue by deleting from the head of the queue while it is still being read from for playback. Regardless, it means calling stop on the sink seems to be a bad option.

The other thing I noticed while swapping between alsa and rodio backends is that rodio seems to be consuming quite a bit more CPU. Here is the output from top while playing the same track:

rodio

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 3360 libresp+  20   0   25528   7584   6544 S  33.7  1.5   1:14.25 librespot

alsa

 PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 3631 libresp+  20   0   25540   7472   6520 S  11.7  1.5   0:19.31 librespot

The rodio backend seems to average around 30% CPU usage while spiking up to 45% at times. Where as the alsa backend typical sits around 12% CPU, spiking up to 22%.

@chrisbp
Copy link

chrisbp commented Mar 17, 2019

@chrisbp have you got libasound2-dev installed?

No, the Odroid C2 is running Arch and I can't see an equivalent dev package there. It already has alsa-lib and alsa-utils though.

Having said that I have rodio working on another armv7 device running Ubuntu 16.04 which only has libasound2 installed, not libasound2-dev.

@sashahilton00
Copy link
Member

@chrisbp have you got libasound2-dev installed?

No, the Odroid C2 is running Arch and I can't see an equivalent dev package there. It already has alsa-lib and alsa-utils though.

try pulseaudio-alsa

@willstott101
Copy link
Contributor Author

Yeah it seems calling stop or releasing a Rodio sink reliably causes that fuzz for me. I've come to decide releasing the audio device is reasonably important for me, as switching default device during playback is something I'd like to work.

Your comments @chrisbp inspired me to try pausing the sink, and sleeping the thread for a second. As pausing in Rodio makes a Source simply return 0 in it's iterator. However as soon as I eventually then call stop I get a small bit of fuzz. Even if the Sink should have seen nothing but 0 for 3 seconds.

Honestly I think Rodio's architecture isn't really suited for this use-case. As far as I can tell we always have to convert to f32 samples. I'd be tempted to re-construct this Sink using CPAL and https://docs.rs/sample/0.10.0/sample/interpolate/struct.Converter.html

There is no guaranteeing that we wouldn't see the same fuzz when releasing a device in CPAL though.

@sashahilton00
Copy link
Member

@willstott101 do the detach and sleep_until_end methods provided by rodio make any difference?

@sashahilton00
Copy link
Member

@willstott101 @chrisbp unless there's an objection, I'm going to merge this, for a couple of reasons:

  • It removes the last major blocker for Windows
  • If offloads audio handling to rodio, which is where we're looking to go with librespot

Whilst there are issues apparently with fuzz or sink creation, this backend has been added such that the other backends can still be used. Thus, I would rather get people using librespot out of the box to move over to rodio, and gather any feedback on potential problems, and provide a note in the readme that points people to manually specifying an alternative backend at compile time if rodio is problematic.

@willstott101 if you're ok to rebase to master, will get this merged later today.

@willstott101
Copy link
Contributor Author

The fuzz is not present in this branch so I'm happy for you to merge it.

It's only when trying to release the Rodio Sink that we see the fuzz. I'll look into this more in other branches. No worries.

@sashahilton00 sashahilton00 merged commit 6d7d385 into librespot-org:master Mar 20, 2019
@sashahilton00
Copy link
Member

Thanks for your work on this. Feel free to open another PR if you work out what causes the fuzz and come up with a fix.

@microfx
Copy link

microfx commented Feb 24, 2022

Sooo.. is there a guide somewhere how to install, use and connect rodio (to jack)?

@willstott101
Copy link
Contributor Author

I haven't touched any of this since before Jack was added to CPAL (rodio's audio host abstraction layer).

https://github.com/librespot-org/librespot/blob/dev/playback/src/audio_backend/mod.rs#L135

Implies to me: build with the rodiojack-backend feature and launch with --backend rodiojack

See the docs here: https://github.com/librespot-org/librespot/wiki/Audio-Backends#usage

@microfx
Copy link

microfx commented Feb 24, 2022

Thank you very much for your quick answer!

how do I build with rodiojack-backend?

like this ~/librespot$ cargo build --release --rodio-backend?

@willstott101
Copy link
Contributor Author

cargo build --release --features rodiojack-backend (https://github.com/librespot-org/librespot/wiki/Compiling#features)

@microfx
Copy link

microfx commented Feb 24, 2022

Thanks man!

Feb 24 14:11:59 MiCROLABS-P3 systemd[1]: Started Raspotify.
Feb 24 14:11:59 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:11:59Z INFO  librespot] librespot 0.3.1 616809b (Built on 2022-02-24, Build ID: 2ohmOrfb, Profile: release)
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070"
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_core::session] Authenticated as "user" !
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:00Z INFO  librespot_core::session] Country: "DE"
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: StreamError(DefaultStreamConfigError(DeviceNotAvailable))', playback/src/audio_backend/rodio.rs:178:53
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]: stack backtrace:
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    0:   0x999620 - std::backtrace_rs::backtrace::libunwind::trace::h532c701585cd392d
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    1:   0x999620 - std::backtrace_rs::backtrace::trace_unsynchronized::h15e96deae50ea7f1
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    2:   0x999620 - std::sys_common::backtrace::_print_fmt::h2de65accbd58b3e4
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:67:5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    3:   0x999620 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h85671ae76efc2464
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:46:22
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    4:   0x9c1454 - core::fmt::write::h57e38047c74956ea
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/fmt/mod.rs:1149:17
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    5:   0x991cc0 - std::io::Write::write_fmt::hcccb69ae7e0e5712
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/io/mod.rs:1697:15
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    6:   0x99b68c - std::sys_common::backtrace::_print::hedd1975fac8ef971
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:49:5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    7:   0x99b68c - std::sys_common::backtrace::print::h271955abde78a83a
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:36:9
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    8:   0x99b68c - std::panicking::default_hook::{{closure}}::h1901391bc1a47fa7
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:211:50
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:    9:   0x99b134 - std::panicking::default_hook::h76fa136e1f70a214
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:228:9
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   10:   0x99bd64 - std::panicking::rust_panic_with_hook::h51720dfc44e3b7d9
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:606:17
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   11:   0x99b840 - std::panicking::begin_panic_handler::{{closure}}::he47604371a389898
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:502:13
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   12:   0x999b90 - std::sys_common::backtrace::__rust_end_short_backtrace::h18b71b6ad5f9e064
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:139:18
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   13:   0x99b798 - rust_begin_unwind
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   14:   0x5261c0 - core::panicking::panic_fmt::h9db124518765ce19
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   15:   0x526294 - core::result::unwrap_failed::hd5176608923f89af
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1613:5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   16:   0x6a0468 - librespot_playback::audio_backend::rodio::open::hdd109a095229e5d6
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   17:   0x69efc8 - librespot_playback::audio_backend::rodio::mk_rodio::h70f7dce122d0dd01
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   18:   0x5d2e98 - std::sys_common::backtrace::__rust_begin_short_backtrace::h75043918b3fbf764
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   19:   0x5be850 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h64d841c4ca0ba432
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   20:   0x9a0c08 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb88965a49e8ef6d9
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694:9
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   21:   0x9a0c08 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3a9e9491476f36e5
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694:9
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:   22:   0x9a0c08 - std::sys::unix::thread::Thread::new::thread_start::h83a6b2d187373076
Feb 24 14:12:00 MiCROLABS-P3 librespot[23822]:                        at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys/unix/thread.rs:106:17
Feb 24 14:12:21 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:21Z ERROR librespot_playback::player] Player Commands Error: channel closed
Feb 24 14:12:26 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:26Z ERROR librespot_playback::player] Player Commands Error: channel closed
Feb 24 14:12:27 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:27Z ERROR librespot_playback::player] Player Commands Error: channel closed
Feb 24 14:12:28 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:28Z ERROR librespot_playback::player] Player Commands Error: channel closed
Feb 24 14:12:28 MiCROLABS-P3 librespot[23822]: [2022-02-24T13:12:28Z ERROR librespot_playback::player] Player Commands Error: channel closed

hmm... seems like I need to change alsa to jack or something? What are my config options?

@willstott101
Copy link
Contributor Author

Perhaps check out the chat: https://gitter.im/librespot-org/spotify-connect-resources I don't think this issue is really the right forum for this kind of help. Better to keep Pull Requests to conversation about their specific changes.

@microfx
Copy link

microfx commented Feb 24, 2022

hmm..

Perhaps check out the chat: https://gitter.im/librespot-org/spotify-connect-resources I don't think this issue is really the right forum for this kind of help. Better to keep Pull Requests to conversation about their specific changes.

I started a new discussion – maybe you could help out there? Would be fantastic!
#969 (comment)

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants