opusenc.js icon indicating copy to clipboard operation
opusenc.js copied to clipboard

malloc is undefined

Open louisfoster opened this issue 4 years ago • 2 comments

I appear to receive this error when wasm is used (it doesn't happen when using asm):

TypeError: Module.asm._malloc is undefined OpusEncoder.js line 422 > eval:1:118376
    _malloc http://localhost:7711/worker/OpusEncoder.js line 422 > eval:1
    getBufferFor http://localhost:7711/worker/EmsArgs.js:74
    readBlobAsArrayBuffer http://localhost:7711/worker/EmsArgs.js:52

I noticed that if I remove your input disabled attribute in your example and run the encoder twice, the same thing occurs. Is this intentional?

Searching around, the only thing similar is this: https://github.com/emscripten-core/emscripten/issues/6632#issuecomment-394397740

So I might give that a try myself when I have time.

louisfoster avatar May 04 '20 22:05 louisfoster

I appear to receive this error when wasm is used (it doesn't happen when using asm):

Just to be clear, are you using a custom build or the pre-built one from https://blog.rillke.com/opusenc.js/

Anyway, if you find a fix, Pull request is welcome. Thanks

Rillke avatar May 06 '20 09:05 Rillke

Prebuilt, I think the solution in the link will fix, however I am now using a similar lib that seems to compile as described: https://github.com/chris-rudmin/opus-recorder/blob/master/Makefile#L5

louisfoster avatar May 06 '20 12:05 louisfoster