Skip to content

Player::try_seek docs are wrong about only blocking up to ~5ms #896

Description

@liquid-dragons

This is stated here:

/// This blocks between 0 and ~5 milliseconds.

Which is referring to the periodic access here:

rodio/src/player.rs

Lines 137 to 138 in ee3c21f

// If you change the duration update the docs for try_seek!
.periodic_access(Duration::from_millis(5), move |src| {

However, compare this to the documentation for periodic_access().:

rodio/src/source/mod.rs

Lines 547 to 558 in ee3c21f

/// Calls the `access` closure on `Self` the first time the source is iterated and every
/// time `period` elapses.
///
/// Later changes in either `sample_rate()` or `channels_count()` won't be reflected in
/// the rate of access.
///
/// The rate is based on playback speed, so both the following will call `access` when the
/// same samples are reached:
/// `periodic_access(Duration::from_secs(1), ...).speed(2.0)`
/// `speed(2.0).periodic_access(Duration::from_secs(2), ...)`
#[inline]
fn periodic_access<F>(self, period: Duration, access: F) -> PeriodicAccess<Self, F>

Since the access rate is based on playback speed, if I play my music file at half speed, try_seek() I could be waiting for the next access up to ~10ms (or even more for lower playback rates).


This is related to, but technically distinct from these other two seek issues I've found: #638 #876.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions