rodio icon indicating copy to clipboard operation
rodio copied to clipboard

changing speed can cause track_position to become inaccurate

Open yara-blue opened this issue 1 year ago • 2 comments

Speed should only apply changes at frame boundaries since track_position uses those to add up the currently played duration OR track_position should update its internal counter every sample.

  • needs a test first, preferably integration.

yara-blue avatar Nov 11 '24 20:11 yara-blue

This isn't clear .it seems interesting and I may want to go with it .But I don't understand what you mean yet.

ugochukwu-850 avatar Nov 14 '24 08:11 ugochukwu-850

Speed works by changing the sample-rate. The sample rate normally only changes at frame boundaries. Track position assumes it never changes except when a new frame starts (see: https://github.com/RustAudio/rodio/blob/489e184a58c3655e7806318d2a8a7248d5055e67/src/source/position.rs#L103).

We should make it so that speed only changes the sample-rate at frame boundaries and limit the latency this causes by letting speed put an upper bound on frame boundary length.

yara-blue avatar Nov 16 '24 11:11 yara-blue