Rillke / opusenc.js

JavaScript opus encoder
https://blog.rillke.com/opusenc.js/
Other
95 stars 9 forks source link

malloc is undefined #6

Open louisfoster opened 4 years ago

louisfoster commented 4 years ago

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.

Rillke commented 4 years ago

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

louisfoster commented 4 years ago

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