fix: don't clip the start of a track on the pulseaudio backend#328
Open
plisker wants to merge 1 commit into
Open
fix: don't clip the start of a track on the pulseaudio backend#328plisker wants to merge 1 commit into
plisker wants to merge 1 commit into
Conversation
On a cold (non-prefetched) load, pulseaudio Drop() stopped, flushed and restarted the stream. The load path set the new source and resumed before dropping, so the stream was already reading the new track's opening into the buffer, which the flush then discarded — clipping ~1s (devgianlu#292). Drop() now only stops and flushes, matching the Output contract and the other backends. The load path flushes before switching sources, and the seek path resumes explicitly since Drop no longer restarts.
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.
Fixes #292.
On pulseaudio, cold (non-prefetched) track loads start ~1s in.
Drop()is the only backend that self-restarts the stream (Stop+FlushPlaybackStream+Start), against itsOutputcontract ("empties the buffer without waiting"). A load runsSetPrimary->Resume->Drop; sinceResumeno-ops on an already-running stream, the pull loop has already read the new track's opening into the buffer, whichDrop's flush then discards. Prefetched loads buffer ahead and survive it (hence next/prev stay clean).Fix:
Drop()stops and flushes without restarting (matching the alsa/toolbox/pipe backends and the interface contract).Dropno longer restarts.Adds a player test covering the drop-before-switch ordering and the seek resume/paused behavior. Verified on a Raspberry Pi 4 (pipewire-pulse).
Note: seeking in the brief window right after end-of-track auto-pause now resumes playback, since the player now tracks pause state to decide whether to resume after the flush.