- Host the app directory in a public accessible HTTPS server. You can use github page as the host.
- Replace the
name
,appId
, andcontentUrl
inmeta/manifest.json
.- The contentUrl should point to your app directory, like
https://lubobill1990.github.io/Teams-VideoApp-example/app/
- appId can be any unique GUID
- The contentUrl should point to your app directory, like
- zip the meta directory, choose the zip file after clicking Upload a custom app
- Go to a teams meeting, enable the video, and activate the video app.
- open terminal
cd
to the directory of README.md- run
yarn install
- run
yarn start-app
- run
yarn start-container
- open
https://localhost:9000/index.html
in your browser - change
videoFrameHandler
function inapp/index.js
- using emsdk 2.0.30, reference
https://emscripten.org/docs/getting_started/downloads.html
for installing and change version to 2.0.30 byemsdk activate 2.0.30
- compile to wasm by
emcc -o wasm-ccall.js -s TOTAL_MEMORY=64MB -s "EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']" -O3 wasm-ccall.cpp
This app contains sample code for color conversion and WebGL rendering.
- With current processing pipeline, a full round (NV12 -> process -> NV12) is ~28ms.
- The app processing pipeline is critical to performance. Need to carefully choose the intermediate datatype, reduce data redundant as much as possible.
- Besides convert color space, the render/GPU<->CPU copy are more time consuming, we should focus on how to leverage more GPU to reduce data transfer cost and CPU usage. E.g. convert back to nv12 in shader, then copy back the nv12 array only.
- It would highly increase the throughput if there are some mechanisms to enable direct access texture from CPU. I have not found such mechanism in WebGL for now.
Resolution: 1280x720 Laptop CPU: i7-106100U @ 1.80GHz, GPU: Intel UHD Graphics (something like 630).
- Take NV12 input(javascript TypedArray) convert to RGBAf (javascript TypedArray).
- Copy RGBAf to WebGL texture as input.
- WebGL render: The effect is simple, just flip X and Y.
- Copy RGBAU8 (javascript TypedArray) from WebGL texture as output
- Convert RGBAU8 back to NV12 and overwrite the input NV12.
- For RGBAf & RGBAU8(marked as green), they are accessible from javascript (as TypedArray) and wasm (as native pointer). The RGBAf could be more suitable then U8 as inference input.
- Only 1280*720 is supported yet, the resolution is hard-coded for now.
- Dynamic resolution changing is not supported yet.
- For RGBA -> NV12, I think there are something wrong with the prebuilt wasm, probably caused by emscripten compiler, which cause it is slower than NV12->RGBAf.
- Code branch for async copyback have some bugs, which might cause GPU stall on certain execution sequence.