Re: MSP stalled streams, Was: Reviewing the Web Audio API (from webrtc)

On Fri, Mar 30, 2012 at 1:43 AM, Jussi Kalliokoski <
jussi.kalliokoski@gmail.com> wrote:

> I have some use cases in mind, for example a DAW might be rendering
> content to a file, let's say there's a following graph:
>
> Media Input -> Processing Worker (reverb, etc) -> Encoder Worker
>
> The desired behavior is that if the stream is stalled, it won't output
> anything to avoid waiting for input from being written to the file, but if
> the stream is drained, wait until the effects produce just silence, and
> then signal the encoder to stop recording.
>

That is an interesting use-case. It can be solved with the existing spec:
set autoFinish to false on your processing Worker, so that it keeps going
when all inputs have finished. In your processing Worker, you will get
onprocessmedia callbacks with no inputs, and it can keep producing output.
Once you know that you won't ever produce anything but silence, the
processing Worker should call finish() on its ProcessMediaEvent to end its
stream.

I think that's quite a natural solution. There are a couple of problems
with it. One is that you'd like to be able to finish at a particular
sample, and the current API doesn't have a way to do that. Probably the
finish() method should take a time parameter.

The other problem is that we really need two kinds of "autoFinish": one
attribute that lets the Worker control whether it finishes as soon as all
inputs are removed, and another attribute that lets the page control
whether the Worker finishes automatically or not. In your example, some
users of the Worker might want it to keep producing silence indefinitely
while there are no inputs, e.g. because they expect to attach new inputs
later. Probably the best approach is to have an autoFinish attribute on the
ProcessMediaEvent for Worker-side control, in addition to autoFinish on the
stream.

Thanks,
Rob
-- 
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]

Received on Thursday, 29 March 2012 20:37:44 UTC