Closed Bug 1530178 Opened 5 years ago Closed 5 years ago

[Web Audio API] copyFromChannel/copyToChannel error occurs

Categories

(Core :: Web Audio, defect, P3)

65 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla68
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."

Component: Untriaged → Web Audio
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → valentin.millet39

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?

Flags: needinfo?(valentin.millet39)

I'm going to pick this one up, this was part of a school project that is now done.

Attachment #9055177 - Attachment description: Bug 1530178 - Copies data until it runs out of data in either the source or the destination r?padenot → Bug 1530178 - Copies data until it runs out of data in either the source or the destination. r?padenot
Attachment #9055177 - Attachment description: Bug 1530178 - Copies data until it runs out of data in either the source or the destination. r?padenot → Bug 1530178 - copyFromChannel/copyToChannel until end of buffer when destination/source is longer r?padenot

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
Regressions: 1548816
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16708 for changes under testing/web-platform/tests
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: