[PR #456] [MERGED] Add gstreamer backend to librespot #936

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

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/456
Author: @allquixotic
Created: 4/7/2020
Status: Merged
Merged: 7/25/2020
Merged by: @sashahilton00

Base: devHead: gst1.0-2020


📝 Commits (10+)

📊 Changes

7 files changed (+488 additions, -3 deletions)

View changed files

📝 .travis.yml (+3 -0)
📝 Cargo.lock (+345 -0)
📝 Cargo.toml (+1 -0)
📝 playback/Cargo.toml (+8 -3)
playback/src/audio_backend/gstreamer.rs (+115 -0)
📝 playback/src/audio_backend/mod.rs (+7 -0)
📝 playback/src/lib.rs (+9 -0)

📄 Description

Fixes https://github.com/librespot-org/librespot/issues/28

Thanks to the gapless playback enhancements, this is working much better than it did in December. I also recently got rid of all my warnings and did a rustfmt.

One current bug is that the apparent playback position in the Spotify GUI is very slightly (about 1 second) ahead of the actual position of the song as you're hearing it out of your headphones. It's much, much better with the gapless fixes from kaymes, but still slightly behind. This is because the appsrc has a 4k buffer, and some of the other pipeline elements (audio sinks, for example) also have buffers. Without a little bit of pipeline buffering it would be very choppy.

Note: I don't think this backend works particularly well with the assumptions of "gapless mode disabled." It works fine for gapless-enabled though.

I also need to document this backend on the wiki under Audio_Backends, but I don't want to add docs for something that won't be merged, so I'll add that afterwards.

The biggest thing for newbies to understand will be how to write a correct device argument for gstreamer. This is only necessary if the user wants something other than the audio going directly to the autoaudiosink (a gstreamer-determined "sane default" for audio playback based on the user's system), but there are quite some valid use cases for wanting something different (network streaming over rtp or something to a "smart speaker," for instance.)

I'm still sort of a rust newbie, so I will work on improving my branch if this isn't up to snuff yet.


🔄 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/456 **Author:** [@allquixotic](https://github.com/allquixotic) **Created:** 4/7/2020 **Status:** ✅ Merged **Merged:** 7/25/2020 **Merged by:** [@sashahilton00](https://github.com/sashahilton00) **Base:** `dev` ← **Head:** `gst1.0-2020` --- ### 📝 Commits (10+) - [`6707389`](https://github.com/librespot-org/librespot/commit/67073897327f6f0c6a2c6aca63d8f6f4c6545ac9) Forward port plietar's WIP gstreamer backend. - [`ed04c04`](https://github.com/librespot-org/librespot/commit/ed04c049cc484d5e49de5d21b43499c7d8688a91) Working proof of concept with up to date gstreamer bindings and Rust 2018. - [`664c76b`](https://github.com/librespot-org/librespot/commit/664c76b2011d2de0f3e191d505c21d08648a9acb) Fix playback on track change. Pause/resume is still weird. - [`d30ffcd`](https://github.com/librespot-org/librespot/commit/d30ffcd1c0fa673332152417887faf78abd6bbc2) Mostly fix play/pause/stop behavior. Pause is latent. - [`ac0df7e`](https://github.com/librespot-org/librespot/commit/ac0df7e11f42dc640ba6d75e09cd2861e58c53dc) Merge https://github.com/librespot-org/librespot into gst1.0-2020 - [`a55b226`](https://github.com/librespot-org/librespot/commit/a55b226716d618d7838d0af8aacdb4acae7a1c0b) Merge https://github.com/librespot-org/librespot into gst1.0-2020 - [`c5c4552`](https://github.com/librespot-org/librespot/commit/c5c455236e86044179eb882c178f47b24beb22f8) Merge - [`f192bd1`](https://github.com/librespot-org/librespot/commit/f192bd107904199b5f286a7cc1cc70b9152ece8f) gstreamer-1.0 backend: Version updates and squelch warnings - [`1e9a52b`](https://github.com/librespot-org/librespot/commit/1e9a52bd6e4ec15ebac44198cc0c8e404e08911f) Fix auto disposal of pipeline that needs to stay in struct - [`e7093cb`](https://github.com/librespot-org/librespot/commit/e7093cb0bc987ad5a8f53e070136fa3b19781e7b) gstreamer-backend: rustfmt. ### 📊 Changes **7 files changed** (+488 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `.travis.yml` (+3 -0) 📝 `Cargo.lock` (+345 -0) 📝 `Cargo.toml` (+1 -0) 📝 `playback/Cargo.toml` (+8 -3) ➕ `playback/src/audio_backend/gstreamer.rs` (+115 -0) 📝 `playback/src/audio_backend/mod.rs` (+7 -0) 📝 `playback/src/lib.rs` (+9 -0) </details> ### 📄 Description Fixes https://github.com/librespot-org/librespot/issues/28 Thanks to the gapless playback enhancements, this is working much better than it did in December. I also recently got rid of all my warnings and did a rustfmt. One current bug is that the apparent playback position in the Spotify GUI is very slightly (about 1 second) ahead of the actual position of the song as you're hearing it out of your headphones. It's much, _much_ better with the gapless fixes from kaymes, but still slightly behind. This is because the appsrc has a 4k buffer, and some of the other pipeline elements (audio sinks, for example) also have buffers. Without a little bit of pipeline buffering it would be very choppy. Note: I don't think this backend works particularly well with the assumptions of "gapless mode disabled." It works fine for gapless-enabled though. I also need to document this backend on the wiki under Audio_Backends, but I don't want to add docs for something that won't be merged, so I'll add that afterwards. The biggest thing for newbies to understand will be how to write a correct `device` argument for gstreamer. This is only necessary if the user wants something other than the audio going directly to the `autoaudiosink` (a gstreamer-determined "sane default" for audio playback based on the user's system), but there are quite some valid use cases for wanting something different (network streaming over rtp or something to a "smart speaker," for instance.) I'm still sort of a rust newbie, so I will work on improving my branch if this isn't up to snuff yet. --- <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:31 +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#936
No description provided.