[PR #6] [MERGED] Make librespot more robust against audio failures #774

Closed
opened 2026-02-27 19:59:53 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/6
Author: @brain0
Created: 12/18/2017
Status: Merged
Merged: 12/19/2017
Merged by: @ComlOnline

Base: masterHead: work


📝 Commits (4)

  • 35ec580 Disable the "variable does not need to be mutable" compiler warning in generated code
  • f5d8019 Add proper error handling to the pulseaudio backend and ensure that no invalid pointers are passed to pulseaudio
  • f250179 Join the player thread when the player is dropped
  • 4cda8af Handle audio sink errors in the player

📊 Changes

7 files changed (+160 additions, -56 deletions)

View changed files

📝 Cargo.lock (+8 -7)
📝 Cargo.toml (+2 -1)
📝 core/src/lib.in.rs (+1 -0)
📝 src/audio_backend/pulseaudio.rs (+66 -26)
📝 src/lib.in.rs (+1 -0)
📝 src/lib.rs (+3 -0)
📝 src/player.rs (+79 -22)

📄 Description

When using librespot with pulseaudio over TCP, connection failures always lead to panics. This patchset introduces proper error handling in the pulseaudio backend and ensures that no undefined behaviour occurs in the FFI calls to pulseaudio. It also introduces proper error handling in the player thread: When the player fails to open or write audio, instead of panicking, it tries to reconnect to the sink every 5 seconds until it succeeds or playback is stopped.

With this patchset, librespot has been very reliable when running with pulseaudio and setting PULSE_SERVER to a remote host, even when the remote host goes down and comes up again.


🔄 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/6 **Author:** [@brain0](https://github.com/brain0) **Created:** 12/18/2017 **Status:** ✅ Merged **Merged:** 12/19/2017 **Merged by:** [@ComlOnline](https://github.com/ComlOnline) **Base:** `master` ← **Head:** `work` --- ### 📝 Commits (4) - [`35ec580`](https://github.com/librespot-org/librespot/commit/35ec580eac78ab43684f7d2c24de71153db582ff) Disable the "variable does not need to be mutable" compiler warning in generated code - [`f5d8019`](https://github.com/librespot-org/librespot/commit/f5d8019c18ef565b237bbefea9c2dbdde23cd374) Add proper error handling to the pulseaudio backend and ensure that no invalid pointers are passed to pulseaudio - [`f250179`](https://github.com/librespot-org/librespot/commit/f250179fed78ecc5f26e55085f8f59043e6c3da5) Join the player thread when the player is dropped - [`4cda8af`](https://github.com/librespot-org/librespot/commit/4cda8affcd188815ef552889676eca0b6bf1724f) Handle audio sink errors in the player ### 📊 Changes **7 files changed** (+160 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+8 -7) 📝 `Cargo.toml` (+2 -1) 📝 `core/src/lib.in.rs` (+1 -0) 📝 `src/audio_backend/pulseaudio.rs` (+66 -26) 📝 `src/lib.in.rs` (+1 -0) 📝 `src/lib.rs` (+3 -0) 📝 `src/player.rs` (+79 -22) </details> ### 📄 Description When using librespot with pulseaudio over TCP, connection failures always lead to panics. This patchset introduces proper error handling in the pulseaudio backend and ensures that no undefined behaviour occurs in the FFI calls to pulseaudio. It also introduces proper error handling in the player thread: When the player fails to open or write audio, instead of panicking, it tries to reconnect to the sink every 5 seconds until it succeeds or playback is stopped. With this patchset, librespot has been very reliable when running with pulseaudio and setting PULSE_SERVER to a remote host, even when the remote host goes down and comes up again. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 19:59:53 +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#774
No description provided.