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

Add AudioDataInit.transfer #688

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions index.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -2727,6 +2727,7 @@
[EnforceRange] required unsigned long numberOfChannels;
[EnforceRange] required long long timestamp; // microseconds
required BufferSource data;
sequence<ArrayBuffer> transfer = [];
};
</xmp>

Expand Down Expand Up @@ -2758,7 +2759,12 @@
AudioData(init)
</dfn>
1. If |init| is not a [=valid AudioDataInit=], throw a {{TypeError}}.
2. Let |frame| be a new {{AudioData}} object, initialized as follows:
2. If |init|.{{AudioDataInit/transfer}} contains more than one reference
to the same {{ArrayBuffer}}, then throw a {{DataCloneError}} {{DOMException}}.
3. For each |transferable| in |init|.{{AudioDataInit/transfer}}:
1. If {{platform object/[[Detached]]}} internal slot is `true`,
then throw a {{DataCloneError}} {{DOMException}}.
4. Let |frame| be a new {{AudioData}} object, initialized as follows:
1. Assign `false` to {{platform object/[[Detached]]}}.
2. Assign |init|.{{AudioDataInit/format}} to
{{AudioData/[[format]]}}.
Expand All @@ -2770,11 +2776,20 @@
{{AudioData/[[number of channels]]}}.
6. Assign |init|.{{AudioDataInit/timestamp}} to
{{AudioData/[[timestamp]]}}.
7. Let |resource| be a [=media resource=] containing a copy of
|init|.{{AudioDataInit/data}}.
8. Let |resourceReference| be a reference to |resource|.
9. Assign |resourceReference| to {{AudioData/[[resource reference]]}}.
3. Return |frame|.
7. If |init|.{{AudioDataInit/transfer}} contains an {{ArrayBuffer}}
referenced by |init|.{{AudioDataInit/data}} the User Agent
<em class="rfc2119">MAY</em> choose to:
1. Let |resource| be a new [=media resource=] referencing sample data
in |data|.
8. Otherwise:
1. Let |resource| be a [=media resource=] containing a copy of
|init|.{{AudioDataInit/data}}.
9. Let |resourceReference| be a reference to |resource|.
10. Assign |resourceReference| to {{AudioData/[[resource reference]]}}.
5. For each |transferable| in |init|.{{AudioDataInit/transfer}}:
1. Perform [DetachArrayBuffer](https://tc39.es/ecma262/#sec-detacharraybuffer)
on |transferable|
6. Return |frame|.

### Attributes ###{#audiodata-attributes}

Expand Down