Skip to content

a stream is now seekable if bytes_len is known #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dvdsk
Copy link
Member

@dvdsk dvdsk commented Jun 1, 2025

Unfortunatly this reveals a bug(?) in symphonia regarding format recognition. M4a is no longer openable with symphonia. To resolve that we can set seekable to true without having bytes_len even though that is breaking an invarint. (seekable can not be true if bytes_len is unknown).

Unfortunatly this reviels a bug(?) in symphonia regarding format
recognition. M4a is no longer openable with symphonia. To resolve that
we can set `seekable` to true without having `bytes_len` even though
that is breaking an invarint. (seekable can not be true if bytes_len is
unknown).
@PetrGlad
Copy link
Collaborator

PetrGlad commented Jun 1, 2025

Can this be automatically tested?

Copy link
Collaborator

@roderickvd roderickvd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I commented over at pdeljanov/Symphonia#340 (comment), there are legitimate reasons why a source could have a known byte_len yet not be random-access seekable.

Therefore I would like to re-instate the builder option, and determine let can_seek = mss.is_seekable() && mss.byte_len().is_some().

Then in try_seek we can still support seek, but only forward. When a users tries to seek backward, we could catch this error and propagate it with a help text "set byte_len to enable random access seeking".

@dvdsk
Copy link
Member Author

dvdsk commented Jun 2, 2025

As I commented over at pdeljanov/Symphonia#340 (comment), there are legitimate reasons why a source could have a known byte_len yet not be random-access seekable.

from that comment, copied here for context:

is_seekable implies support for random-access seeking. Sources that could have their byte length known, yet only be forward-seekable include pipes, buffers from stdin or a read-once network stream.

Writing this PR I assumed such forward-seekable only applications are too niche to be worth supporting in rodio. As I understood it then it was either support them and make the general seek case less usable.

Then in try_seek we can still support seek, but only forward. When a users tries to seek backward, we could catch this error and propagate it with a help text "set byte_len to enable random access seeking".

I was unaware this is an option. That seems like a good solution.

@roderickvd would you mind taking this out of my hands? My symphonia knowledge is minimal, I do not have the time to dive into it and as we have seen this issue is resisting my quick attempts at quickly throwing something together.

@roderickvd
Copy link
Collaborator

Sure, I'll try and make some time for it this week. With this and #731 we can hopefully put a release out.

roderickvd added a commit to roderickvd/rodio that referenced this pull request Jun 3, 2025
- Automatically enable is_seekable when byte_len is set
- Add specific error for random access seeking without byte_len
- Clarify documentation for builder methods with default states
- Test forward-only vs random access seeking scenarios

Fixes RustAudio#740
Supersedes RustAudio#744
@roderickvd
Copy link
Collaborator

Alternative proposed in #745

roderickvd added a commit to roderickvd/rodio that referenced this pull request Jun 4, 2025
- Automatically enable is_seekable when byte_len is set
- Add specific error for random access seeking without byte_len
- Clarify documentation for builder methods with default states
- Test forward-only vs random access seeking scenarios

Fixes RustAudio#740
Supersedes RustAudio#744
roderickvd added a commit that referenced this pull request Jun 4, 2025
* Improve seeking behavior and error handling

- Automatically enable is_seekable when byte_len is set
- Add specific error for random access seeking without byte_len
- Clarify documentation for builder methods with default states
- Test forward-only vs random access seeking scenarios

Fixes #740
Supersedes #744

* Add missing required features for examples
@roderickvd
Copy link
Collaborator

Superseded by #745

@roderickvd roderickvd closed this Jun 4, 2025
@roderickvd roderickvd deleted the symphonia_is_seekable_default branch June 4, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants