[PR #297] [MERGED] Improve playback speed #866

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

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/297
Author: @kaymes
Created: 3/9/2019
Status: Merged
Merged: 3/13/2019
Merged by: @sashahilton00

Base: masterHead: kaymes-faster


📝 Commits (5)

  • a3c63b4 Speed up loading of files by requesting file and key in parallel.
  • 2e492e4 Speed up playback by avoiding unnecessary seek when playing from the beginning of a file.
  • f62709f Merge remote-tracking branch 'origin/master' into kaymes-faster
  • 43959ee Commit missing ;
  • 43dcc6b Remove deft over debug message.

📊 Changes

1 file changed (+9 additions, -7 deletions)

View changed files

📝 playback/src/player.rs (+9 -7)

📄 Description

I did some profiling to figure out why librespot is so much slower than the official Spotify client to start a playback. Of the issues I found, two were quick fixes, which I'm committing here.

  1. seek() on an audio stream is a very slow operation here because under the hood we do an interval search over the file. Thus, many different parts of the file must be downloaded inspected. Librespot does such a seek when playing a file from the beginning. This is unnecessary.

  2. the network requests for downloading the key and the encrypted file can be done in parallel which saves on round trip time.


🔄 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/297 **Author:** [@kaymes](https://github.com/kaymes) **Created:** 3/9/2019 **Status:** ✅ Merged **Merged:** 3/13/2019 **Merged by:** [@sashahilton00](https://github.com/sashahilton00) **Base:** `master` ← **Head:** `kaymes-faster` --- ### 📝 Commits (5) - [`a3c63b4`](https://github.com/librespot-org/librespot/commit/a3c63b4e055f3ec68432d4a27479bed102e68e9e) Speed up loading of files by requesting file and key in parallel. - [`2e492e4`](https://github.com/librespot-org/librespot/commit/2e492e4d4478f00ccc24da3538e19b66eb33c861) Speed up playback by avoiding unnecessary seek when playing from the beginning of a file. - [`f62709f`](https://github.com/librespot-org/librespot/commit/f62709fb9db9b8deb4ea151c2a947e364892f5fa) Merge remote-tracking branch 'origin/master' into kaymes-faster - [`43959ee`](https://github.com/librespot-org/librespot/commit/43959ee788a8307ac15a5bf7fa0ba41a0182ff57) Commit missing ; - [`43dcc6b`](https://github.com/librespot-org/librespot/commit/43dcc6b55b6b17c0270c567999b636df047fcb0c) Remove deft over debug message. ### 📊 Changes **1 file changed** (+9 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `playback/src/player.rs` (+9 -7) </details> ### 📄 Description I did some profiling to figure out why librespot is so much slower than the official Spotify client to start a playback. Of the issues I found, two were quick fixes, which I'm committing here. 1) seek() on an audio stream is a very slow operation here because under the hood we do an interval search over the file. Thus, many different parts of the file must be downloaded inspected. Librespot does such a seek when playing a file from the beginning. This is unnecessary. 2) the network requests for downloading the key and the encrypted file can be done in parallel which saves on round trip time. --- <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:15 +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#866
No description provided.