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

Increasing player ring buffer size breaks seeking #559

Open
jlama opened this issue Jan 22, 2025 · 2 comments
Open

Increasing player ring buffer size breaks seeking #559

jlama opened this issue Jan 22, 2025 · 2 comments
Labels

Comments

@jlama
Copy link
Contributor

jlama commented Jan 22, 2025

Increasing the ring buffer size revealed another bug in the AudioPlayerNode architecture: once the decoding is complete, seeking no longer works, due to the decoder thread exiting as soon as decoding is complete.

If the ring buffer is large enough, decoding could complete much sooner than the rendering. If the user tries to seek between decoding complete and rendering complete, nothing will happen.

@sbooth sbooth added the bug label Jan 22, 2025
@sbooth
Copy link
Owner

sbooth commented Jan 22, 2025

I think this bug is independent of the ring buffer size. It occurs anytime when seeking after decoding is complete- it's just that with larger buffer sizes the buffered duration is more noticeable.

Thanks for the report. I will have to think about the best way to handle the issue.

@jlama
Copy link
Contributor Author

jlama commented Jan 22, 2025

My suggestion would be to let the decoder thread handle the whole DecoderState lifetime, from the start of decoding to end of rendering. It would also handle calling the various delegates and accounting for the rendered frames. This way we can also get rid of the event queue.
With the decoder thread handling everything related to decoding, it would be easier to handle a seek request in the post-decoding phase.

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