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

Use WebAssembly for decoding work #5044

Closed
tachibana-shin opened this issue Nov 18, 2022 · 1 comment
Closed

Use WebAssembly for decoding work #5044

tachibana-shin opened this issue Nov 18, 2022 · 1 comment

Comments

@tachibana-shin
Copy link

Is your feature request related to a problem? Please describe.

The only immediate problem is that hls.js Web Worker will consume 100% of the CPU.

Describe the solution you'd like

we can use Go or Rust to compile to WASM greatly increase the performance for decoding

Additional context

No response

@tachibana-shin tachibana-shin added Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Nov 18, 2022
@robwalch robwalch removed the Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. label Nov 21, 2022
@itsjamie itsjamie changed the title use Web AAssembly for decoding work Use WebAssembly for decoding work Nov 27, 2022
@itsjamie
Copy link
Collaborator

It's very possible that we could get some performance improvements by using WebAssembly, but I think there are a few things to do before embarking on this;

I think we would want to offer a ESM bundle if we were to include a Go/Rust/C++ WASM module. They all have relatively large allocators for the WASM portion, so we'd probably want to offer the complete transcode workflow via WASM, and remove the ability to toggle enableWorker for this build. Otherwise we'd end up with a lot of duplicate code to handle transmuxing and the WASM module to do the same. That means this build could also drop webpack-webworkify.

Additionally, we have to be very careful of falling into the trap that WASM is the magic bullet to fix performance problems. If we just translate our current code to WASM, we'll lose out on any major improvements, but have a entirely different language package to maintain.

Personally, I think if there was a WASM based transmuxer that could support MPEG-TS / MP4 that already existed, it would make a lot of sense to try it out, but it's a lot of work to get to a demo only to find out we have a lot of optimization work ahead to get something usable.

@robwalch robwalch closed this as not planned Won't fix, can't repro, duplicate, stale May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants