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: Wed, 17 Jul 2013 11:00:52 -0400
Message-ID: <CANTur_6FUXgRdFX60gU1RM_UpbW7uXYS5uVxFj+yizkTxzvdOA@mail.gmail.com>
To: Jer Noble <jer.noble@apple.com>
Cc: "robert@ocallahan.org" <robert@ocallahan.org>, "K. Gadd" <kg@luminance.org>, Olivier Thereaux <Olivier.Thereaux@bbc.co.uk>, WG <public-audio@w3.org>
On Wed, Jul 17, 2013 at 2:39 AM, Jer Noble <jer.noble@apple.com> wrote:

>
> > On Jul 16, 2013, at 11:17 PM, Robert O'Callahan <robert@ocallahan.org>
> wrote:
> >
> > It's not clear to me how this example works. If the decoder is decoding
> into a buffer that's being played at the same time, hilarity ensues. If
> it's not, we can reclaim the buffer internally as I pointed out in a
> previous message.
>
> I wasn't targeting your specific proposal in this example, but rather the
> worst case specification of "always copy". Your proposal does an admirable
> job of limiting mallocs and memcopys wherever possible, at the expense of
> implementation and spec complexity.


Maybe I'm missing something, but as far as I know, nobody has made such a
proposal, so I'm not sure why we're discussing that.

As Robert pointed out earlier in this thread, the only cases where the
current proposals suggest blind copying are AudioParam.setValueCurveAtTime
and WaveShaperNode.curve.  The basic reason is that those APIs deal with
Float32Arrays and not AudioBuffers, so neither Robert's or Jer's proposals
for AudioBuffers will directly address that, unless we're willing to break
those APIs and make them use AudioBuffers.

That is also a crucial point which I believe is getting lost in this
conversation.  These performance concerns are only about how efficiently we
can run legacy code while maintaining the current API.  If we're willing to
break API backwards compatibility by making AudioBuffers immutable for
example, and avoid using Float32Arrays anywhere except as an argument to
the AudioBuffer constructor, then we'll avoid all of the memcpy costs in
the normal usage of the API, except when creating an AudioBuffer.  So, it's
not like that our two alternatives are not fixing the race conditions at
all, or memcpy data all the time on every call into the API.

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>
Received on Wednesday, 17 July 2013 15:02:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:10 UTC