mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1121] Native pipewire backend #522
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#522
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @darkdragon-001 on GitHub (Feb 18, 2023).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1121
Is your feature request related to a problem? Please describe.
Reduce latency by supporting Pipewire directly.
Describe the solution you'd like
Add a native Pipewire backend.
Describe alternatives you've considered
Continue using PulseAudio backend in combination with pipewire-pulseaudio conversion.
Additional context
Add any other context or screenshots about the feature request here.
@JasonLG1979 commented on GitHub (Feb 19, 2023):
I looked into writing a native pipewire backend a while back briefly just out of curiosity but at the time the Rust pipewire bindings were not the greatest (they may have improved since?).
For pure playback latency is not really a problem. Super low audio latency is generally not a requirement unless you're recording and/or trying to live monitor recordings. What latency you would notice in librespot would be 99% network related, basically the delay between clicking a Spotify UI and librespot reacting. Reducing audio latency is not going to improve that. Librespot already has sub one sec audio latency (in most cases) which is barely perceivable if at all.
If the main reason for wanting a pipewire backend is to reduce latency currently it's more trouble then it's worth. You're looking at shaving maybe literally a couple millisecs and a lot of work for really no reason other than having the shiniest new thing.
The ALSA backend should also work just fine. Pipewire has compatibility layers for both.
@darkdragon-001 commented on GitHub (Feb 19, 2023):
Maybe you could give it another try and see if the libraries have improved since?
~ Pipewire FAQ
So this could improve battery usage on mobile devices as well.
@JasonLG1979 commented on GitHub (Feb 19, 2023):
I don't have the need. I use librespot with the ALSA backend. I have no need for middleware. You or anyone else (including the spot devs) are free to write a pipewire backend.
Now you're reaching for straws. The FAQ says that pipewire provides pro level latency with consumer level power efficiency not that pipewire saves power over pulseaudio. Any measurable power savings you would get would be from switching from pulseaudio to pipewire on a server level. I seriously doubt that there would be any measurable power savings by switching librespot to a pipewire backend. Librespot is extremely light weight as is (it uses 10% CPU on my Pi Zero v2). If you want more power efficiency use the ALSA backend and cut out the middle man.
I agree that pipewire is the future of Linux desktop audio but the urgency is just not there to justify yet another audio backend for librespot when the ALSA and pulseaudio backends work just fine in pipewire.
@JasonLG1979 commented on GitHub (Feb 19, 2023):
In the case of something like spot they would be better served IMHO to just use librespot for the API bits and write their own player parts that use GStreamer rather then using librespot's player and backends. That way they could just target Gstreamer's APIs that are better suited for desktop app usage and they would get ALSA/pulseaudio/pipewire integration for free afterwards. That's what you would do normally for a desktop app.
@darkdragon-001 commented on GitHub (Feb 19, 2023):
This is a good hint! I created a corresponding issue xou816/spot#600
@JasonLG1979 commented on GitHub (Feb 19, 2023):
I didn't mean just switching to the Gstreamer librespot backend. I mean writing their own Gstreamer based player logic. The current librespot Gstreamer backend just handles playback of the decoded PCM, it doesn't utilize even a fraction of Gstreamer's potential. A completely Gstreamer based player would handle basically everything from decoding, playlists, eq's, volume normalization and whatnot. Not the same thing at all.
@darkdragon-001 commented on GitHub (Feb 23, 2023):
What would be the advantage of writing own gstreamer player logic instead of using librespot's gstreamer implementation apart from having more options to control?
@JasonLG1979 commented on GitHub (Feb 23, 2023):
The player and backends are designed for a cli app use case and are really more example then something meant to be used downstream. The general idea is that someone should write their own player. In the case of a Linux desktop app it's pretty natural to choose Gstreamer since it's the defacto multimedia framework in that space.