mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #554] recent version of librespot 70% CPU during playback to named pipe where old version used 3% #352
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#352
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 @mikeszila on GitHub (Dec 21, 2020).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/554
This is the first issue report I've ever written on git. Please let me know if I'm missing anything.
A version of librespot I compiled last year uses under 3% CPU during playback. I recompiled the current version and it now uses 70% CPU during playback. I put the old version back and it's back down to 3%. Both on the same Raspberry Pi 4B running Raspbian Buster and kernel 4.19.75-v7l+. In my application librespot writes to a named pipe which is read at approximately playback speed by an application I've written in nodejs. Even with high CPU everything sounds OK except for some skips and stutters probably caused by the high CPU.
The old commit with low CPU from last year was:
github.com/librespot-org/librespot@cbba63f60bThe new commit with high CPU from a few days ago is:
github.com/librespot-org/librespot@0adb8516a6.My reason for re-compiling is a slight modification to get the current volume setting and prevent softvolume adjustments from being applied to the audio. Both last years and the current version had this change. I doubt this has anything to do with the high CPU but it's included for completeness. The change can be seen here: https://github.com/mikeszila/librespot
I followed the instructions here and ran "cargo build --no-default-features".
I run librespot with this command: ./librespot -v -n hello -b 320 -c /home/pi/audio/local/librespot --enable-volume-normalisation --backend pipe --device /home/pi/audio/local/librespot/audiofifo
I read data from the pipe in chunks at approximately playback speed. I tried reading a bunch of different chunk sizes including 441, 882, 512, 1024, 2048 samples at a time. No real change.
Thanks for any help you can give.
@michaelherger commented on GitHub (Dec 21, 2020):
In my experience using
--releaseor not can make a huge difference. By default the binary is built indevmode, which compiles fast, but runs slow.@mikeszila commented on GitHub (Dec 23, 2020):
not using --release was my issue. Thank you!!!