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

Synchronous encoding/decoding #19

Closed
steveanton opened this issue Sep 16, 2019 · 5 comments
Closed

Synchronous encoding/decoding #19

steveanton opened this issue Sep 16, 2019 · 5 comments
Labels
maybe Ideas that might be in scope, and worth discussing

Comments

@steveanton
Copy link
Contributor

@padenot mentioned there are some use cases for synchronously encoding/decoding media in contrast to the current API proposal which encourages/mandates asynchronous execution.

@steveanton
Copy link
Contributor Author

Would it be possible to keep the same API but have a flag which instructs the user agent to run the codec synchronously?

I'm not sure all the requirements for the synchronous API (e.g., whether it's ok to unwind the stack or not), but this approach would at least ensure the encoding/decoding happens in the same task.

@pthatcherg pthatcherg added the maybe Ideas that might be in scope, and worth discussing label Sep 18, 2019
@anthumchris
Copy link

I think synch audio decoding could be especially important for an AudioWorklet, which would need to use synchronous functions within its process() loop.

@chcunningham
Copy link
Collaborator

@anthumchris - I wouldn't expect folks to do much decoding in the AudioWorklet process() loop. Audio rendering needs to meet tight deadlines and be glitch free. The ideal setup would be to do decoding in a worker (async is fine) and send the decoded output to AudioWorklet using a SharedArrayBuffer. See this overview.

@padenot
Copy link
Collaborator

padenot commented Jul 6, 2020

Being able to synchronously decode is essential for folding a bit of the packetization latency inside the audio output latency, for a decode-type scenario and lowering the overall end-to-end latency.

@chcunningham
Copy link
Collaborator

This also came up in #51. That issue was closed with rationale:

We discussed this in the call w/ audio epxerts. It is true that many are coming from a synchronous API, but they concluded that this was not a requirement for them. We also discussed how our API's under the hood are often async and they stated that they did not desire for us to hide that from them at the JS layer. Please open a new issue for this if I've overlooked anything.

Closing this issue with same reasoning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe Ideas that might be in scope, and worth discussing
Projects
None yet
Development

No branches or pull requests

5 participants