connect: preserve continuation on same-context refresh - #1749
Open
paintarm287 wants to merge 2 commits into
Open
connect: preserve continuation on same-context refresh#1749paintarm287 wants to merge 2 commits into
paintarm287 wants to merge 2 commits into
Conversation
Author
|
The failing Clippy check appears unrelated to this PR. CI is running Rust 1.98.0 and fails on clippy::needless_late_init in src/main.rs:1625, which is unchanged by this PR. The remaining CI checks, including builds and cross-compiles, pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserve the existing live
next_trackscontinuation when Spotify sends anUpdateContextfor the same context and the current playback position can still be mapped successfully.Previously, the current position was mapped correctly but
next_trackswas then cleared and rebuilt. This could replace the established continuation with earlier tracks from the same playlist and replay tracks that had already been traversed.Reproduction
Tested against
devat:1599145bf2c98660d35b17817b3386767a7e4b42With shuffle and repeat disabled:
next_tracksdecreased normally to 61.Spotify sent
UpdateContextfor the same 97-track playlist.next_tracksjumped from 61 to 79.The following skip decreased it to 78 and replayed a track already traversed earlier in the session.
Fix
For a same-context refresh where the current playback position maps successfully, retain the established live continuation instead of clearing and rebuilding
next_tracks.Genuine context changes continue to use the existing reset/rebuild path.
Validation
With the patch, same-context refreshes preserved the existing continuation:
77 -> 7775 -> 7574 -> 74A subsequent manual skip test continued monotonically from 73 down through 45 with no upward queue reset and no unexpected replay.
The final qualification was also performed with the external replay-protection workaround disabled (
SPOTIFY_REPLAY_GUARD=no), confirming that the corrected behaviour came from librespot itself.Checks
cargo fmt --all -- --checkgit diff --checklive A/B reproduction against unmodified and patched
dev