History

Allow compilation to JavaScript via emscripten

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.

Brion Vibber committed 11 years ago

Commit 522639f1 parent bee0d7d2 files · +7 −0Browse files

Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 2 files). Show all

Unified · Split

codec/common/src/WelsThreadLib.cpp+6−0
@@ -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#else492#else
487 493
488 size_t len = sizeof (pInfo->ProcessorCount);494 size_t len = sizeof (pInfo->ProcessorCount);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t