Skip to content

Commit 515785b

Browse files
committed
Add serialization and deserialization steps
1 parent e15dcda commit 515785b

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

index.bs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ enum RTCEncodedVideoFrameType {
278278
};
279279
</pre>
280280
<table dfn-for="RTCEncodedVideoFrameType" class="simple">
281-
<caption>Enumeration description</caption>
281+
<caption>Enumeration description</caption>
282282
<thead>
283283
<tr>
284284
<th>Enum value</th><th>Description</th>
@@ -371,7 +371,7 @@ dictionary RTCEncodedVideoFrameMetadata {
371371
<dd>
372372
<p>
373373
The media presentation timestamp (PTS) in microseconds of raw frame, matching the
374-
{{VideoFrame/timestamp}} for raw frames which correspond to this frame.
374+
{{VideoFrame/timestamp}} for raw frames which correspond to this frame.
375375
</p>
376376
</dd>
377377
</dl>
@@ -433,6 +433,27 @@ interface RTCEncodedVideoFrame {
433433
</dd>
434434
</dl>
435435

436+
### Serialization ### {#RTCEncodedVideoFrame-serialization}
437+
438+
{{RTCEncodedVideoFrame}} objects are serializable objects [[HTML]].
439+
Their serialization steps, given |value|, |serialized|, and |forStorage|, are:
440+
441+
1. If |forStorage| is true, then throw a "DataCloneError" DOMException.
442+
1. Set |serialized|.`[[metadata]]` to an internal representation of |value|'s metadata.
443+
1. Set |serialized|.`[[data]]` to |value|.`[[data]]`
444+
445+
Their deserialization steps, given |serialized|, |value| and |realm|, are:
446+
447+
1. Set |value|'s metadata to the platform object representation of |serialized|.`[[metadata]]`
448+
1. Set |value|.`[[data]]` to |serialized|.`[[data]]`.
449+
450+
<p class="note">
451+
The internal form of a serialized RTCEncodedVideoFrame is not observable;
452+
it is defined chiefly so that it can be used with frame cloning in the
453+
[$writeEncodedData$] algortihm and in the StructuredClone operation.
454+
An implementation is therefore free to choose whatever method works best.
455+
</p>
456+
436457
## <dfn dictionary>RTCEncodedAudioFrameMetadata</dfn> dictionary ## {#RTCEncodedAudioFrameMetadata}
437458
<pre class="idl">
438459
dictionary RTCEncodedAudioFrameMetadata {
@@ -529,6 +550,20 @@ interface RTCEncodedAudioFrame {
529550
</dl>
530551

531552

553+
### Serialization ### {#RTCEncodedAudioFrame-serialization}
554+
555+
{{RTCEncodedAudioFrame}} objects are serializable objects [[HTML]].
556+
Their serialization steps, given |value|, |serialized|, and |forStorage|, are:
557+
558+
1. If |forStorage| is true, then throw a "DataCloneError" DOMException.
559+
1. Set |serialized|.`[[metadata]]` to an internal representation of |value|'s metadata.
560+
1. Set |serialized|.`[[data]]` to |value|.`[[data]]`
561+
562+
Their deserialization steps, given |serialized|, |value| and |realm|, are:
563+
564+
1. Set |value|'s metadata to the platform object representation of |serialized|.`[[metadata]]`
565+
1. Set |value|.`[[data]]` to |serialized|.`[[data]]`.
566+
532567
// New interfaces to expose JavaScript-based transforms.
533568
##Interfaces
534569
<pre class="idl">

0 commit comments

Comments
 (0)