ffmpegwasm / ffmpegwasm/ffmpeg.wasm

emscripten_sleep does not work becuase the native setTimeout is overwritten

Open
#611 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
17.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

```
function setTimeout(timeout) {
Module["timeout"] = timeout;
}

function safeSetTimeout(func, timeout) {
return setTimeout(()=>{ // will call the wrong function
callUserCallback(func)
}
, timeout)
}
function _emscripten_sleep(ms) {
return Asyncify.handleSleep(wakeUp=>safeSetTimeout(wakeUp, ms))
}
```

Have this problem because I use emscripten_sleep in ffmpeg code. It's better to rename the `setTimeout` function to other name.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.