Fix Speed::try_seek to handle seek position independently of speed factor (#876)#881
Closed
FrogSnot wants to merge 1 commit intoRustAudio:masterfrom
Closed
Fix Speed::try_seek to handle seek position independently of speed factor (#876)#881FrogSnot wants to merge 1 commit intoRustAudio:masterfrom
FrogSnot wants to merge 1 commit intoRustAudio:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses incorrect seeking behavior when playback speed is set to a non-1.0 factor by changing Speed::try_seek so it forwards the requested seek position directly to the inner source (instead of scaling it by the speed factor), and documents the fix.
Changes:
- Updated
Speed::try_seekto passposthrough unchanged. - Updated
Speedmodule documentation to state seek is independent of the speed factor. - Added a changelog entry for the fix (references #876).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/source/speed.rs |
Changes Speed::try_seek semantics and updates module docs accordingly. |
CHANGELOG.md |
Records the Speed::try_seek fix under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> { | ||
| let pos_accounting_for_speedup = pos.mul_f32(self.factor); | ||
| self.input.try_seek(pos_accounting_for_speedup) | ||
| self.input.try_seek(pos) |
Comment on lines
+142
to
144
| self.input.try_seek(pos) | ||
| } | ||
| } |
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.
Closes #876
As discussed in the issue, seeking while at non-1x speed was incorrectly scaling the seek duration. This PR ensures the seek position is passed directly to the inner source.