Skip to content
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

Seek breaks span #691

Open
dvdsk opened this issue Jan 23, 2025 · 4 comments
Open

Seek breaks span #691

dvdsk opened this issue Jan 23, 2025 · 4 comments
Labels

Comments

@dvdsk
Copy link
Collaborator

dvdsk commented Jan 23, 2025

Seek might need padding silence when resample rate or channel count change. Since the consumer has no way to know they have.

Alternative, make seek an exception and make the consumer recall sample_rate, channel count & span len.

@dvdsk dvdsk added the bug label Jan 23, 2025
@PetrGlad
Copy link
Collaborator

We may require that all variable sources are wrapped into something like UniformSourceIterator, so in most cases spans can only change channels, not sample rate...

@dvdsk
Copy link
Collaborator Author

dvdsk commented Jan 24, 2025

would not help since seek is implemented at the decoder level. Those inherently do not have a uniform sample rate. And we can not resample to such a uniform source if the spans are not correct.

@PetrGlad
Copy link
Collaborator

PetrGlad commented Jan 25, 2025

At least it would help to not care about the sample rate changes downstream, in sources that come after decoders.

With decoders themselves, I am thinking of more comprehensive test harness that would generate both various source audio files and random seeks, something like property testing but for our case.

@dvdsk
Copy link
Collaborator Author

dvdsk commented Jan 25, 2025

At least it would help to not care about the sample rate changes downstream

it would, but it would come at a performance cost. Hifi-resampling is performance intensive, resampling everything at the edges might be wasteful. Maybe we can make the resampler very lazy, that would help....

Honestly I think we would need a prototype before making any decision. A rodio fork that only supports a few sources (lets say queue & mix) and works by informed resampling at the input. With informed I mean that idea I had earlier with the output communicating its preferred sample rate down and everything adjusting along the way.

After I finish fixing queue I can work on the informed sample rate bit, once that's done you could make the prototype. Then we have to figure out some workloads to compare the implementations with. If the performance difference is positive or trivial the code simplifications might be worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants