What this sounds like, is ffprobe was assuming to run once itself, so it
leaves variables set in its heap, and other global state variables.
You'd probably have to introduce something to reload the initial memory
state... or modify the program to not assume variables are 0 initialized....


On Fri, Jun 21, 2019 at 10:05 AM Kyo Lee <[email protected]> wrote:

> Hi, it's amazing for emscripten build c/c++ program to wasm, and run at a
> website !
>
> Recently, I try to emcc build ffprobe.bc to ffprobe.wasm, there output two
> file : ffprobe.js and ffprobe.wasm
>
> the ffprobe.js is a bridge to fetch and compile ffprobe.wasm, and run it
> by WebAssembly Api at browsers Web Worker
>
> I use emcc --pre-js --post-js to set my custom change in ffprobe.js
>
> emcc \
>   -s EXIT_RUNTIME=0 \
>   -s ENVIRONMENT=worker \
>   -s WASM=1 \
>   --pre-js pre.js \
>   --post-js post.js \
>   -o ffprobe.js \
>   ffprobe.bc && \
>
> My Question Below:
>
> If I wrapped the compiled code by a function, and work it on Web Worker,
> it works good.
>
> But when run the function multiple, fetch and init ffprobe.wasm will call
> multiple. (its slow...)
>
> I try to find a way to just re run the compiled binary.
>
> So I change the code,to re run() multiple,below is what I do at my Web
> Worker onmessage function :
>
> self.onmessage = function (e) {
>     - set noIntialRun: true
>     - set Module['calledRun'] = false
>     - set shouldRunNow = true
>     - call Module['run'](e.data.arguments)
> }
>
> > -------------------------------------------------------------- <
>
> The result is
>
>     - if i just call arguments = ["-version"], it works well at any times
> I call the function
>     - if i do the FS usage,like arguments = ["-v", "error",
> "-select_streams", "v:0", "-show_entries", "stream=width,height", "-of",
> "csv=s=x:p=0", "/my_data/test_1.flv"],this output the video metainfo width
> and height. it works well at first call, and the second time , stderr: 
> Argument
> '/my_data/test2.flv' provided as input filename, but '/my_data/test1.flv'
> was already specified.
>
>     The error reason is:
>        when call run(arguments) at the second time, the arguments have
> double length (the old args concat the new args), just like "ffprobe
> -version -version" ("-version -version" command can work well. but the FS
> usage double length will throw the error -- same behavior at terminal when
> ffprobe double -i file)
>
> is there a way to "RESET arguments" ?
> can someone help me ... thx all !
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/be85ecb3-2b97-419d-b0ea-0f6f3414beae%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/be85ecb3-2b97-419d-b0ea-0f6f3414beae%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAA2GJqXWTfQtXvgVE_osh5AFDbkJ5BN9Ct8y%2BBTXmhYm%3DdLkvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to