Open krogank9 opened 6 years ago
pthread support using SharedArrayBuffers using web workers is planned in emscripten, but currently it is disabled due to the spectre bug in nearly all browsers. See https://kripken.github.io/emscripten-site/docs/porting/pthreads.html
It was re-enabled in Chrome and Edge, but still disabled in Firefox and Safari. Not sure if I want to enable it now. Maybe will experiment later.
Threading is only supported in wasm builds, and there can not be a wasm build having threading support and a fallback if no threading is available. The idea of wasm is to have multiple builds and choose at runtime which one to load. As threading is currently only supported by chrome enabling SharedArrayBuffers only for the threading build would be no problem. In fact every browser which will support wasm threading will have to reactivate SharedArrayBuffers.
@Kagami are you able to build ffmpeg with emcc without the --disable-thread configure option? I am trying but I have a lot of errors I don't understand...
@damien-monni No, please read tpetry's comment. First it needs to be modularized, which I did some time ago, but people were not willing to pay a 100 bucks for it (which is less than my hourly rate). So I wasn't interested in sharing it. Don't think I'm an asshole, but open-source developers are being treated like assholes. You ask Kagami for help for something you could find an answer to in the comment above yours...
Actually I did read tpetry comment or I wouldn't have asked. I'm more comfortable with Javascript than C compilation so I am not sure I understand.
I understand that threading is only supported in wasm and need SharedArrayBuffer. This is actually why I need threading on ffmpeg so I can enable shared memory between multiple wasm. But I am a bit confused on why ffmeg does not compile with emcc if I remove the --disable-thread option. What do you mean by modularized ? Does it means that we should edit ffmpeg source code so it only works with threading enabled and then we should be able to compile it with emcc?
@damien-monni Oh damn it. Sorry for my rudeness. I've thought the issue was clear. To make a proper WASM build work, it needs to be modularized first.
Currently I am using the ffmpeg.js file ripped out of videoconverter.js. Which I don't think makes use of multiple cores.