[erlang-questions] Real time audio transcoding with a port driver

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Tue Jul 2 11:07:06 CEST 2013

On Tue, Jul 2, 2013 at 10:41 AM, Dan Bender <danbenderr@REDACTED> wrote:

> Why not use NIF?
> Encoding/decoding a single frame will probably take about 3ms.
> If the NIF will bump reductions, will this be ok?

A NIF should run for at most 1ms. So you will have to break the frame into
multiple cooperative/reentrant calls and call your NIF several times, or
you need to spawn a background thread which runs the code and then replies
when it is done, usually through a message.

Otherwise, you are blocking the scheduler and this is a problem which can
mess up the internal scheduler timing in Erlang. This problem *might* be
solved in R17 where so-called dirty schedulers will be present. These are
probably able to solve this problem in another way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130702/6702d4c4/attachment.htm>

More information about the erlang-questions mailing list