[Web Audio API] copyFromChannel/copyToChannel error occurs
Categories
(Core :: Web Audio, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: gaito, Assigned: valentin.millet39, NeedInfo)
References
()
Details
(Keywords: parity-chrome, parity-edge)
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Steps to reproduce:
Call [WebAudioAPI] AudioBuffer.copyFromChannel() or AudioBuffer.copyToChannel(), with the end of the copy exceeds the size of the AudioBuffer.
const audiobuf = actx.createBuffer(1, 100, actx.sampleRate);
const buf = new Float32Array(50);
audiobuf.copyFromChannel(buf, 0, 90); // should copy from 90 to 140
audiobuf.copyToChannel(buf, 0, 90);
SampleCode is Here : https://www.g200kg.com/demo/test/copyfrom.html
Actual results:
"IndexSizeError: Index or size is negative or greater than the allowed amount"
error occurs. It is different from specification.
Expected results:
If the beginning of the copy is within the size of the AudioBuffer, no error occurs and copying until the end of the AudioBuffer should be executed.
https://webaudio.github.io/web-audio-api/#dom-audiobuffer-copyfromchannel
"1.4.3. Methods
copyFromChannel(destination, channelNumber, startInChannel)
Then the number of frames copied from buffer to destination is min(Nb-k,Nf). If this is less than Nf, then the remaining elements of destination are not modified."
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
Comment 4•5 years ago
|
||
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:valentin.millet39, could you have a look please?
Comment 5•5 years ago
|
||
I'm going to pick this one up, this was part of a school project that is now done.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 6•5 years ago
|
||
This is a no-op, but is allowed per spec:
An optional offset to copy the data to. If startInChannel is greater than the
length of the AudioBuffer, an IndexSizeError MUST be thrown.
If the numbers are equals, this shouldn't throw.
Pushed by padenot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fe9afae0f868 copyFromChannel/copyToChannel until end of buffer when destination/source is longer r=padenot,karlt https://hg.mozilla.org/integration/autoland/rev/1c983b486cd0 Fix audiobuffer-copy-channel.html to allow copyFromChannel/copyToChannel wth an offset of n on an array that is n elements long. r=karlt https://hg.mozilla.org/integration/autoland/rev/bfebd4300498 Update WPT expectations. r=padenot
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fe9afae0f868
https://hg.mozilla.org/mozilla-central/rev/1c983b486cd0
https://hg.mozilla.org/mozilla-central/rev/bfebd4300498
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16708 for changes under testing/web-platform/tests
Description
•