Re: ScriptProcessorNode behavior without JavsScript references

2013-09-18 15:38, Chris Wilson skrev:
> On Wed, Sep 18, 2013 at 6:26 AM, Marcus Geelnard <mage@opera.com 
> <mailto:mage@opera.com>> wrote:
>
>     That sounds like a reasonable solution (or it could just
>     disconnect itself?).
>
>
> Yes, presumably you could just disconnect yourself, and that would 
> cause the onaudioprocess to stop being called (and thus release 
> observability).
>
>     In any event I think that we need to clearly instruct developers
>     to signal the death of ScriptProcessorNodes, or they could leak
>     like mad (e.g. if you create one ScriptProcessorNode per note
>     played in a MIDI application).
>
>
> Yep, that's the major concern here.  I foresee LOTS of leaky SP scenarios.
>
>     One way could be to add an explicit "active" attribute to the node
>     or something (that would be hard to miss for developers).
>
>
> But they won't be checking them - because they won't have references 
> anymore.  :)

You'd do it from the onaudioprocess event. I just figured it would be 
clearer to have an appropriately named attribute than to have to use 
disconnect or nulling the event handler.

Also, I have a feeling that it's a better idea to let the audio engine 
decide when it's time to disconnect a node than leaving it up to a 
single node in the graph. For instance, a ScriptProcessorNode with zero 
tail effects (e.g. a gain) could say "I'm idle" immediately, but without 
knowing if all of it's inputs are idle it shouldn't really disconnect 
itself. Otherwise you have to rely on input data analysis and heuristics 
(that can obviously fail).

/Marcus

>
> -Chris


-- 
Marcus Geelnard
Technical Lead, Mobile Infrastructure
Opera Software

Received on Wednesday, 18 September 2013 14:29:33 UTC