|
1720 | 1720 | constructor(EncodedAudioChunkInit init);
|
1721 | 1721 | readonly attribute EncodedAudioChunkType type;
|
1722 | 1722 | readonly attribute unsigned long long timestamp; // microseconds
|
1723 |
| - readonly attribute ArrayBuffer data; |
| 1723 | + readonly attribute unsigned long byteLength; |
| 1724 | + |
| 1725 | + undefined readInto(ArrayBufferView dst); |
1724 | 1726 | };
|
1725 | 1727 |
|
1726 | 1728 | dictionary EncodedAudioChunkInit {
|
|
1735 | 1737 | };
|
1736 | 1738 | </xmp>
|
1737 | 1739 |
|
| 1740 | +### Internal Slots ### {#encodedaudiochunk-internal-slots} |
| 1741 | +: <dfn attribute for=EncodedAudioChunk>[[internal data]]</dfn></dt> |
| 1742 | +:: An array of bytes repsenting the encoded chunk data. |
| 1743 | + |
1738 | 1744 | ### Constructors ###{#encodedaudiochunk-constructors}
|
1739 | 1745 | <dfn constructor for=EncodedAudioChunk title="EncodedAudioChunk(init)">
|
1740 | 1746 | EncodedAudioChunk(init)
|
1741 | 1747 | </dfn>
|
1742 | 1748 | 1. Let |chunk| be a new {{EncodedAudioChunk}} object, initialized as follows
|
1743 |
| - 1. Assign `init.type` to `chunk.type`. |
1744 |
| - 2. Assign `init.timestamp` to `chunk.timestamp`. |
1745 |
| - 3. Assign a copy of `init.data` to `chunk.data`. |
| 1749 | + 1. Assign `init.type` to {{EncodedAudioChunk/type}}. |
| 1750 | + 2. Assign `init.timestamp` to {{EncodedAudioChunk/timestamp}}. |
| 1751 | + 3. Assign a copy of `init.data` to {{EncodedAudioChunk/[[internal data]]}}. |
| 1752 | + 4. Assign `init.data.byteLength` to {{EncodedAudioChunk/byteLength}}; |
1746 | 1753 | 5. Return |chunk|.
|
1747 | 1754 |
|
1748 | 1755 | ### Attributes ###{#encodedaudiochunk-attributes}
|
1749 | 1756 | <dl>
|
1750 |
| - <dt><dfn attribute for=EncodedAudioChunk>type</dfn></dt> |
1751 |
| - <dd>Describes whether the chunk is a key frame.</dd> |
| 1757 | +: <dfn attribute for=EncodedAudioChunk>type</dfn> |
| 1758 | +:: Describes whether the chunk is a key frame. |
1752 | 1759 |
|
1753 |
| - <dt><dfn attribute for=EncodedAudioChunk>timestamp</dfn></dt> |
1754 |
| - <dd>The presentation timestamp, given in microseconds.</dd> |
| 1760 | +: <dfn attribute for=EncodedAudioChunk>timestamp</dfn> |
| 1761 | +:: The presentation timestamp, given in microseconds. |
1755 | 1762 |
|
1756 |
| - <dt><dfn attribute for=EncodedAudioChunk>data</dfn></dt> |
1757 |
| - <dd>A sequence of bytes containing encoded audio data.</dd> |
1758 |
| -</dl> |
| 1763 | +: <dfn attribute for=EncodedAudioChunk>byteLength</dfn> |
| 1764 | +:: The byte length of {{EncodedAudioChunk/[[internal data]]}}. |
| 1765 | + |
| 1766 | +### Methods ###{#encodedaudiochunk-methods} |
| 1767 | +: <dfn method for=EncodedAudioChunk>readInto(dst)</dfn> |
| 1768 | +:: When invoked, run these steps: |
| 1769 | + 1. If {{EncodedAudioChunk/byteLength}} is greater than |
| 1770 | + |dst|.`byteLength`, |
| 1771 | + throw a {{TypeError}}. |
| 1772 | + 2. Copy the {{EncodedAudioChunk/[[internal data]]}} into |dst|. |
1759 | 1773 |
|
1760 | 1774 | EncodedVideoChunk Interface{#encodedvideochunk-interface}
|
1761 | 1775 | -----------------------------------------------------------
|
|
1766 | 1780 | readonly attribute EncodedVideoChunkType type;
|
1767 | 1781 | readonly attribute unsigned long long timestamp; // microseconds
|
1768 | 1782 | readonly attribute unsigned long long? duration; // microseconds
|
1769 |
| - readonly attribute ArrayBuffer data; |
| 1783 | + readonly attribute unsigned long byteLength; |
| 1784 | + |
| 1785 | + undefined readInto(ArrayBufferView dst); |
1770 | 1786 | };
|
1771 | 1787 |
|
1772 | 1788 | dictionary EncodedVideoChunkInit {
|
|
1782 | 1798 | };
|
1783 | 1799 | </xmp>
|
1784 | 1800 |
|
| 1801 | +### Internal Slots ### {#encodedvideochunk-internal-slots} |
| 1802 | +: <dfn attribute for=EncodedVideoChunk>[[internal data]]</dfn></dt> |
| 1803 | +:: An array of bytes repsenting the encoded chunk data. |
| 1804 | + |
1785 | 1805 | ### Constructors ###{#encodedvideochunk-constructors}
|
1786 | 1806 | <dfn constructor for=EncodedVideoChunk title="EncodedVideoChunk(init)">
|
1787 | 1807 | EncodedVideoChunk(init)
|
1788 | 1808 | </dfn>
|
1789 | 1809 | 1. Let |chunk| be a new {{EncodedVideoChunk}} object, initialized as follows
|
1790 |
| - 1. Assign `init.type` to `chunk.type`. |
1791 |
| - 2. Assign `init.timestamp` to `chunk.timestamp`. |
| 1810 | + 1. Assign `init.type` to {{EncodedVideoChunk/type}}. |
| 1811 | + 2. Assign `init.timestamp` to {{EncodedVideoChunk/timestamp}}. |
1792 | 1812 | 3. If duration is present in init, assign `init.duration` to
|
1793 |
| - `chunk.duration`. Otherwise, assign null to `chunk.duration`. |
1794 |
| -2. Assign a copy of `init.data` to `chunk.data`. |
| 1813 | + {{EncodedVideoChunk/duration}}. Otherwise, assign `null` to |
| 1814 | + {{EncodedVideoChunk/duration}}. |
| 1815 | + 4. Assign a copy of `init.data` to {{EncodedVideoChunk/[[internal data]]}}. |
| 1816 | + 5. Assign `init.data.byteLength` to {{EncodedVideoChunk/byteLength}}; |
1795 | 1817 | 3. Return |chunk|.
|
1796 | 1818 |
|
1797 | 1819 | ### Attributes ###{#encodedvideochunk-attributes}
|
1798 |
| -<dl> |
1799 |
| - <dt><dfn attribute for=EncodedVideoChunk>type</dfn></dt> |
1800 |
| - <dd>Describes whether the chunk is a key frame or not.</dd> |
| 1820 | +: <dfn attribute for=EncodedVideoChunk>type</dfn> |
| 1821 | +:: Describes whether the chunk is a key frame or not. |
1801 | 1822 |
|
1802 |
| - <dt><dfn attribute for=EncodedVideoChunk>timestamp</dfn></dt> |
1803 |
| - <dd>The presentation timestamp, given in microseconds.</dd> |
| 1823 | +: <dfn attribute for=EncodedVideoChunk>timestamp</dfn> |
| 1824 | +:: The presentation timestamp, given in microseconds. |
1804 | 1825 |
|
1805 |
| - <dt><dfn attribute for=EncodedVideoChunk>duration</dfn></dt> |
1806 |
| - <dd>The presentation duration, given in microseconds.</dd> |
| 1826 | +: <dfn attribute for=EncodedVideoChunk>duration</dfn> |
| 1827 | +:: The presentation duration, given in microseconds. |
1807 | 1828 |
|
1808 |
| - <dt><dfn attribute for=EncodedVideoChunk>data</dfn></dt> |
1809 |
| - <dd>A sequence of bytes containing encoded video data.</dd> |
1810 |
| -</dl> |
| 1829 | +: <dfn attribute for=EncodedVideoChunk>byteLength</dfn> |
| 1830 | +:: The byte length of {{EncodedVideoChunk/[[internal data]]}}. |
1811 | 1831 |
|
| 1832 | +### Methods ###{#encodedvideochunk-methods} |
| 1833 | +: <dfn method for=EncodedVideoChunk>readInto(dst)</dfn> |
| 1834 | +:: When invoked, run these steps: |
| 1835 | + 1. If {{EncodedVideoChunk/byteLength}} is greater than |
| 1836 | + |dst|.`byteLength`, |
| 1837 | + throw a {{TypeError}}. |
| 1838 | + 2. Copy the {{EncodedVideoChunk/[[internal data]]}} into |dst|. |
1812 | 1839 |
|
1813 | 1840 | Raw Media Interfaces (Frames){#raw-media-interfaces}
|
1814 | 1841 | ====================================================
|
|
2300 | 2327 | This concern is mitigated by ensuring that input and output interfaces are
|
2301 | 2328 | immutable.
|
2302 | 2329 |
|
2303 |
| -ISSUE: EncodedVideoChunk and EncodedAudioChunk currently expose a mutable |
2304 |
| -data. See <a href="https://github.com/w3c/webcodecs/issues/80">#80</a>. |
2305 |
| - |
2306 | 2330 | Privacy Considerations{#privacy-considerations}
|
2307 | 2331 | ===============================================
|
2308 | 2332 | The primary privacy impact is an increased ability to fingerprint users by
|
|
0 commit comments