[PR #314] [CLOSED] [Rodio] Re-acquire audio sink when (re)starting playback. #874

Closed
opened 2026-02-27 20:00:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/314
Author: @willstott101
Created: 3/20/2019
Status: Closed

Base: masterHead: rodio-release-sink


📝 Commits (2)

  • 6c6f355 [Rodio] Re-acquire audio sink when (re)starting playback.
  • c8806f5 [Rodio] Drop sink don't stop it.

📊 Changes

1 file changed (+37 additions, -30 deletions)

View changed files

📝 playback/src/audio_backend/rodio.rs (+37 -30)

📄 Description

This releases the audio sink and re-acquires it when skipping/pausing a song.

This is useful for switching playback device on desktop machines.

In an ideal world Rodio would check to see if the default sink has changed and switch automatically. But for the moment I find this behaviour acceptable, as I have a couple of playback devices I use.

This has a nice side effect of clearing the sink when stopping playback, which can make librespot feel more responsive.

I expect the performance issues seen previously by @chrisbp in https://github.com/librespot-org/librespot/pull/277 will only be fixed by not using rodio::Sink and rodio's mixer. Meaning this whole backend will need re-writing at some point to support an as-yet-non-existent very simple Rodio API for efficient playback of a single Source. So this PR may prove pointless.

N.B. Currently this causes a fuzz noise because it plays the first 5ms of every queued audio chunk when stopping. Waiting on https://github.com/tomaka/rodio/pull/221 to fix that.

I have excluded Cargo.lock cause I'm using a local Rodio and CPAL so it's pretty meaningless.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/314 **Author:** [@willstott101](https://github.com/willstott101) **Created:** 3/20/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `rodio-release-sink` --- ### 📝 Commits (2) - [`6c6f355`](https://github.com/librespot-org/librespot/commit/6c6f355c00fa5353d359942dd43df84b3479999c) [Rodio] Re-acquire audio sink when (re)starting playback. - [`c8806f5`](https://github.com/librespot-org/librespot/commit/c8806f57b63a32a9c71134543e599e5bc22eebe6) [Rodio] Drop sink don't stop it. ### 📊 Changes **1 file changed** (+37 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `playback/src/audio_backend/rodio.rs` (+37 -30) </details> ### 📄 Description This releases the audio sink and re-acquires it when skipping/pausing a song. This is useful for switching playback device on desktop machines. In an ideal world Rodio would check to see if the default sink has changed and switch automatically. But for the moment I find this behaviour acceptable, as I have a couple of playback devices I use. This has a nice side effect of clearing the sink when stopping playback, which can make librespot feel more responsive. I expect the performance issues seen previously by @chrisbp in https://github.com/librespot-org/librespot/pull/277 will only be fixed by not using rodio::Sink and rodio's mixer. Meaning this whole backend will need re-writing at some point to support an as-yet-non-existent very simple Rodio API for efficient playback of a single Source. So this PR may prove pointless. N.B. Currently this causes a fuzz noise because it plays the first 5ms of every queued audio chunk when stopping. Waiting on https://github.com/tomaka/rodio/pull/221 to fix that. I have excluded Cargo.lock cause I'm using a local Rodio and CPAL so it's pretty meaningless. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:00:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#874
No description provided.