Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copyTo from planar to interleave should copy / convert all channels #819

Open
padenot opened this issue Jul 15, 2024 · 2 comments
Open

copyTo from planar to interleave should copy / convert all channels #819

padenot opened this issue Jul 15, 2024 · 2 comments

Comments

@padenot
Copy link
Collaborator

padenot commented Jul 15, 2024

It is useful to copy all frames of an AudioData containing planar data to a buffer containing interleaved data, in one go. However, planeIndex is required in copyTo AudioDatacopyToOptions, so one has to write:

    let data = new AudioData({ ... });
    let destInterleaved = new Int16Array(...);
    data.copyTo(destInterleaved, {planeIndex: 0, format: "s16"});

and this appears to copy all channels in Chrome (and soon, Firefox), despite the planeIndex:0 bit. I think it's good behaviour and we should clarify this in the spec.

@chrisguttandin
Copy link
Contributor

I think that's possibly already written down. The description of an interleaved buffer in 9.3.1. Arrangement of audio buffer says ...

The AudioData has a single plane, that contains a number of elements therefore equal to [[number of frames]] * [[number of channels]].

But planeIndex: 0 could maybe be optional since 0 is the only valid value when copying as an interleaved buffer.

@padenot
Copy link
Collaborator Author

padenot commented Jul 16, 2024

planeIndex:0 is about the source, not the destination. We're copying from a planar buffer into an interleaved buffer here.

It could be made optional in this case, clearly indicating intent.

moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 17, 2024
w3c/webcodecs#819

Differential Revision: https://phabricator.services.mozilla.com/D216561

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1907438
gecko-commit: f909b83620331385e7bb8ef1291b7df7a310f9a5
gecko-reviewers: chunmin
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 17, 2024
w3c/webcodecs#819

Differential Revision: https://phabricator.services.mozilla.com/D216561

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1907438
gecko-commit: f909b83620331385e7bb8ef1291b7df7a310f9a5
gecko-reviewers: chunmin
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this issue Jul 18, 2024
sadym-chromium pushed a commit to web-platform-tests/wpt that referenced this issue Jul 18, 2024
w3c/webcodecs#819

Differential Revision: https://phabricator.services.mozilla.com/D216561

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1907438
gecko-commit: f909b83620331385e7bb8ef1291b7df7a310f9a5
gecko-reviewers: chunmin
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this issue Jul 22, 2024
w3c/webcodecs#819

Differential Revision: https://phabricator.services.mozilla.com/D216561

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1907438
gecko-commit: f909b83620331385e7bb8ef1291b7df7a310f9a5
gecko-reviewers: chunmin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants