- From: Robert O'Callahan <robert@ocallahan.org>
- Date: Wed, 31 Oct 2012 13:14:01 +1300
- To: Chris Rogers <crogers@google.com>
- Cc: Srikumar Karaikudi Subramanian <srikumarks@gmail.com>, Joseph Berkovitz <joe@noteflight.com>, Ehsan Akhgari <ehsan.akhgari@gmail.com>, public-audio@w3.org
- Message-ID: <CAOp6jLac4VVUp3_qgKt3S4D5DY4FRQ6xPefsh8g8Mp43J_pbSQ@mail.gmail.com>
On Wed, Oct 31, 2012 at 10:17 AM, Chris Rogers <crogers@google.com> wrote: > But we're talking about copying potentially megabytes of data. This is > inefficient, especially on resource-constrained mobile devices. > OK, so to be precise the scenario you're worried about is: -- Application creates a large AudioBuffer -- Application plays the AudioBuffer -- While playing, the application calls AudioBuffer.getChannelData() and reads the data (but does not modify the data, since you've said applications don't modify AudioBuffers while playing them) Is that right? In this case, an implementation can still use copy-on-write to avoid copying, although it's more implementation work. For example, when getChannelData() is called while playing the audio, the implementation could create a new ArrayBuffer pointing at the underlying data and mark the data's virtual memory pages read-only while the AudioBuffer is playing. Then any attempt to modify the data through the ArrayBuffer would send a SEGV signal to the process, which could be handled by making a copy of the ArrayBuffer's data into writeable memory and retrying the operation. The above scenario would not trigger any copying with this scheme; copying would only occur if an AudioBuffer is modified while playing. Once again, my position is that this "concurrency" issue is not a > real-world problem, and is only a theoretical one. And we have pretty good > evidence that this is the case. > I think we're still very much in the "early adopter" phase of Web Audio, and we don't yet know much about what an average Web developer might do. Also, usage of Web APIs tends to evolve significantly over time. Often, someone will discover a hitherto obscure technique (which may or may not be a good idea, or in accord with the spec) and it will suddenly become very popular. I will leave you with this thought: http://krijnhoetmer.nl/irc-logs/whatwg/20120329#l-45 :-) Rob -- Jesus called them together and said, “You know that the rulers of the Gentiles lord it over them, and their high officials exercise authority over them. Not so with you. Instead, whoever wants to become great among you must be your servant, and whoever wants to be first must be your slave — just as the Son of Man did not come to be served, but to serve, and to give his life as a ransom for many.” [Matthew 20:25-28]
Received on Wednesday, 31 October 2012 00:14:30 UTC