W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2013

Re: Proposal for fixing race conditions

From: Ehsan Akhgari <ehsan.akhgari@gmail.com>
Date: Thu, 18 Jul 2013 15:03:04 -0400
Message-ID: <CANTur_5gLfPEuDNbd5qBHBVaESfBaHoMKFno7AnG2Hv_sg9C5g@mail.gmail.com>
To: Jer Noble <jer.noble@apple.com>
Cc: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>, Marcus Geelnard <mage@opera.com>, WG <public-audio@w3.org>, "robert@ocallahan.org" <robert@ocallahan.org>, "K. Gadd" <kg@luminance.org>, Olivier Thereaux <Olivier.Thereaux@bbc.co.uk>
On Thu, Jul 18, 2013 at 2:58 PM, Jer Noble <jer.noble@apple.com> wrote:

> On Jul 18, 2013, at 1:07 AM, Jussi Kalliokoski <
> jussi.kalliokoski@gmail.com> wrote:
> > So how about a JavaScript-based Opus decoder that uses an
> AudioBuffer-backed ring buffer to do memcopy-free decoding and playback by
> decoding directly into a mutable AudioBuffer.
> I'm not sure I understood what you're saying here correctly, but you seem
> to be implying that the decoder would run in the main thread which is quite
> suboptimal. What we do in aurora.js (the JS audio decoding framework) is
> that a worker handles the decoding and streaming to avoid clogging the main
> thread + lower the risk of glitches and the worker uses transferable
> ArrayBuffers to avoid copying when juggling between threads. What the main
> thread does is feed that data into a ScriptProcessorNode and IIRC passing
> the ArrayBuffer back to the worker. The worker at no point even knows what
> and AudioBuffer is. So far this seems like the most optimal solution, but
> it already includes a copy of the data.
> Wherever the decoding occurs, whether on the main thread or in a worker,
> the "immutable ArrayBuffer" option will require two buffers in existence:
> the source ArrayBuffer, and the destination AudioBuffer.  This can result
> in a doubling of memory usage by the decoder.

Hmm, the original ArrayBuffer will get GCed if the content code is not
holding on to it, right?  And if they are, that is memory that the content
is keeping alive.  Surely we're not trying to solve the problem of making
it impossible for content to write code which results in an OOM, etc.,
right?  Or am I missing something?

Received on Thursday, 18 July 2013 19:04:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:23 UTC