mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #393] [MERGED] Downloading files with dnamic block sizes for faster seek and playback #907
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#907
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?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/393
Author: @kaymes
Created: 11/2/2019
Status: ✅ Merged
Merged: 11/12/2019
Merged by: @sashahilton00
Base:
dev← Head:dynamic-blocks📝 Commits (10+)
333fc50New file downloading mechanismbf47ca7some debug messages6545674Merge remote-tracking branch 'origin/master' into dynamic-blocks971b2a9Fix compile issues after mergeba7d058Merge remote-tracking branch 'origin/dev' into dynamic-blocks5ad6446remove compiler warning1fcacf7Merge branch 'dynamic-blocks' into comments216bdc0Fix typo9f3e3d0Fix infinite loop bugaf6e33bRemove commented line📊 Changes
8 files changed (+1161 additions, -121 deletions)
View changed files
📝
.travis.yml(+1 -1)📝
Cargo.lock(+1 -0)📝
audio/Cargo.toml(+1 -0)📝
audio/src/fetch.rs(+767 -113)📝
audio/src/lib.rs(+9 -2)➕
audio/src/range_set.rs(+240 -0)📝
core/src/channel.rs(+22 -0)📝
playback/src/player.rs(+120 -5)📄 Description
Quite a while ago, I analysed why librespot is slow when loading files and wrote up my findings in issue #306. Back then, I also started work on a new mechanism to download the files. Unfortunately, I got busy and forgot about it and never submitted it despite it being almost finished. Until today.
Here is my work on a new downloading strategy for librespot.
The idea is, that it uses dynamic block sizes. That is, blocks are small while seeking and during initial play and grow for downloading the grunt of the file. Also, while seeking in a file, it only downloads the requested blocks whereas while streaming, it reads ahead until the entire file is downloaded and placed in the cache.
I also implemented some heuristics based on the observed round-trip (ping) times to determine how much to buffer before playback.
Please test this version of the code.
The thing I'm most worried about is the possibility of not buffering enough because I can't exhaustively test this. This must be tested with different internet connections. If you notice the playback starting and then there's a short pause after which it resumes (a buffer under run), then the ping-time-buffer-heuristic must be adapted.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.