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

Re: memory footprint of AudioBuffer data copies

From: Ehsan Akhgari <ehsan.akhgari@gmail.com>
Date: Tue, 30 Jul 2013 17:41:44 -0400
Message-ID: <CANTur_5W9w8p0S3M=QoD6PdOYaM5+k0J-XUUFfJuJcotOG3+hg@mail.gmail.com>
To: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
Cc: Jer Noble <jer.noble@apple.com>, "K. Gadd" <kg@luminance.org>, Chris Wilson <cwilso@google.com>, Joseph Berkovitz <joe@noteflight.com>, WG WG <public-audio@w3.org>
On Tue, Jul 30, 2013 at 2:23 PM, Jussi Kalliokoski <
jussi.kalliokoski@gmail.com> wrote:

> On Tue, Jul 30, 2013 at 8:15 PM, Jer Noble <jer.noble@apple.com> wrote:
>
>>
>> On Jul 30, 2013, at 10:04 AM, K. Gadd <kg@luminance.org> wrote:
>>
>> > set() isn't automatically a race because you can have it acquire a
>> mutex that the mixer holds when it's using the buffer as an input or output
>> for mixing. Having a mutex acquired every time you set an element of a
>> typed array does not seem like something VM implementers would have been
>> excited to implement. The fact that timing is important is separate from
>> the fact that unsynchronized access to a buffer from multiple threads is
>> risky.
>>
>> A mutex would be overkill here.  Both the start and end points occur on
>> the main thread: after calling (e.g.) AudioBufferSourceNode.start(),
>> further modifications to AudioBuffer would throw.  They would continue to
>> throw until the ‘ended’ event fires.  Doing it this way (rather than
>> acquiring a mutex when the audio thread begins accessing the memory) means
>> the behavior is deterministic and specifiable.
>>
>
> This is the way I assumed it would work, and I think it's a very good
> approach.
>

Another way to think about this is that we would "neuter" the AudioBuffer
when playback on it has started, we're just not using the neutering
mechanism built into typed arrays (which is what Roc's proposal does).

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>
Received on Tuesday, 30 July 2013 21:42:52 UTC

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