Skip to content

Commit

Permalink
Merge pull request w3c#688 from Djuffin/transfer
Browse files Browse the repository at this point in the history
Add AudioDataInit.transfer
  • Loading branch information
aboba authored Jul 6, 2023
2 parents c414b9c + f535233 commit a86fb92
Showing 1 changed file with 21 additions and 6 deletions.
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

0 comments on commit a86fb92

Please sign in to comment.