fix(cache): non-destructive backup restore, playback stability, and crash prevention - #62
Merged
Conversation
…event listen time inflation
…age, and remove premature buffering timeout
…n restore without deleting existing cache
…g non-colliding ID mapping and temp extraction
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.
Overview
This PR delivers non-destructive cache backup & restore merging, playback stability enhancements, and crash prevention fixes.
Key Changes
Non-Destructive Cache Restore:
.uidfile inexoplayer/anddownload/so ExoPlayer never treats existing chunk files as unindexed orphans on startup.(maxExistingId + 1)for new tracks, or reuses the existing chunk ID if the track is already cached.ExoPlayerCacheIndex<activeHexUid>table, completely eliminating cache loss upon restoring.restored_cache_ids.jsonare merged cleanly.Playback Stalling & Chunk Cache Fix:
MusicService.ktandDownloadUtil.ktto only check the requesteddataSpec.position. Previously checking position0Lcaused downstream chunks (e.g. 512KB+) to be misidentified as cached, causing playback to pause or stop after 15–30 seconds.Crash Prevention (
IllegalArgumentException: Out of range):MediaLibrarySessionin aForwardingPlayerthat safely clampsgetBufferedPercentage()within[0, 100]. This eliminates theIllegalArgumentException: Out of range: -2524730863225crash when buffering or playing edge-case tracks.Listen Time Integrity:
Eventlogging during cache restoration, preventing listening time inflation.