Repository navigation
fix(AudioPlayer): process a seek requested while paused on resume - #152
Open
whoisdennis wants to merge 1 commit into
Open
whoisdennis wants to merge 1 commit into
whoisdennis wants to merge 1 commit into
Conversation
seek(to:) schedules processSource, which returns early while the player is paused. resume() never scheduled it again, so unless new data arrived the seek stayed pending: progress reported the target and playback did not move. Schedule processSource on resume, as pause() already does.
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.
Problem
seek(to:)while paused sets the seek request and dispatchesprocessSource, which returns early because the player is paused.resume()restores the state and restarts the engine but never dispatchesprocessSourceagain. Unless new data arrives from the source and triggers it, the seek stays pending:progresskeeps returning the seek target and playback does not move, whilestatereports.playing.It shows when the player stays paused for a moment between
seek(to:)andresume()and the source has already been read to the end (local files, short or fully buffered streams).Fix
Dispatch
processSourceonsourceQueueat the end ofresume(), aspause()already does. A second pass is harmless: the seek is processed once, andseekRequest.versionkeeps a seek issued in between.Tests
New
SeekWhilePausedTests.testSeekWhilePausedLandsAfterResume: play an 8 s tone file, pause, seek to 5 s, stay paused for 1 s, resume, expect progress to move past the target. Fails 3/3 on 1.4.5, passes 3/3 with the fix.swift buildandswift test --parallel: 55 tests, 0 failures.