Skip to content

Commit

Permalink
Merge pull request #18584 from antobinary/backport-18557
Browse files Browse the repository at this point in the history
fix(html5): backport 'Replace wasm detection library #18557' to 2.6
  • Loading branch information
antobinary committed Aug 17, 2023
2 parents 6c047f1 + cb121f7 commit fcd822b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -3,7 +3,6 @@
* It is partially copied under the Apache Public License 2.0 (see https://www.apache.org/licenses/LICENSE-2.0).
*/

import * as wasmcheck from 'wasm-check';
import {
CLEAR_TIMEOUT,
TIMEOUT_TICK,
Expand All @@ -17,6 +16,8 @@ import {
} from '/imports/ui/services/virtual-background/service'
import logger from '/imports/startup/client/logger';

import { simd } from 'wasm-feature-detect/dist/cjs/index';

const blurValue = '25px';

function drawImageProp(ctx, img, x, y, w, h, offsetX, offsetY) {
Expand Down Expand Up @@ -367,8 +368,9 @@ class VirtualBackgroundService {
export async function createVirtualBackgroundService(parameters = null) {
let tflite;
let modelResponse;
const simdSupported = await simd();

if (wasmcheck.feature.simd) {
if (simdSupported) {
tflite = await window.createTFLiteSIMDModule();
modelResponse = await fetch(BASE_PATH+MODELS.model144.path);
} else {
Expand Down Expand Up @@ -401,7 +403,7 @@ export async function createVirtualBackgroundService(parameters = null) {
tflite._loadModel(model.byteLength);

const options = {
...wasmcheck.feature.simd ? MODELS.model144.segmentationDimensions : MODELS.model96.segmentationDimensions,
... simdSupported ? MODELS.model144.segmentationDimensions : MODELS.model96.segmentationDimensions,
virtualBackground: parameters
};

Expand Down
8 changes: 4 additions & 4 deletions bigbluebutton-html5/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bigbluebutton-html5/package.json
Expand Up @@ -89,7 +89,7 @@
"styled-components": "^5.3.3",
"tippy.js": "^5.1.3",
"use-context-selector": "^1.3.7",
"wasm-check": "^2.0.3",
"wasm-feature-detect": "^1.5.1",
"webrtc-adapter": "^8.1.1",
"winston": "^3.7.2",
"yaml": "^2.2.2"
Expand Down

0 comments on commit fcd822b

Please sign in to comment.