Currently the emscripten JavaScript environment for C/C++ programs cannot do multithreading, and doesn't have a sysctl implementation to get hardware CPU count. Hardcode to 1. Using the Linux OS settings works, so not adding a platform file. To build with emscripten (tested 1.30.0): emmake make OS=emscripten ARCH=asmjs The resulting libopenh264.so is LLVM bitcode which can be further linked into an emscripten project for final JavaScript output.
Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 2 files). Show all
Unified · Split
| @@ -483,6 +483,12 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p · 482 unmodified lines | |||
| 483 | 483 | ||
| 484 | return WELS_THREAD_ERROR_OK; | 484 | return WELS_THREAD_ERROR_OK; |
| 485 | 485 | ||
| 486 | #elif defined(__EMSCRIPTEN__) | ||
| 487 | |||
| 488 | // There is not yet a way to determine CPU count in emscripten JS environment. | ||
| 489 | pInfo->ProcessorCount = 1; | ||
| 490 | return WELS_THREAD_ERROR_OK; | ||
| 491 | |||
| 486 | #else | 492 | #else |
| 487 | 493 | ||
| 488 | size_t len = sizeof (pInfo->ProcessorCount); | 494 | size_t len = sizeof (pInfo->ProcessorCount); |