Skip to content

Commit 8f8110e

Browse files
authored
Merge pull request #239 from jan-ivar/serializefix
Fix {de}serialization steps to transfer data appropriately
2 parents 4b61373 + 9553ced commit 8f8110e

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

index.bs

+22-19
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ The <dfn abstract-op>writeEncodedData</dfn> algorithm is given a |rtcObject| as
142142
1. Set |rtcObject|.`[[lastReceivedFrameCounter]]` to |frame|`[[counter]]`.
143143
1. Let |data| be |frame|.`[[data]]`.
144144
1. Let |serializedFrame| be [$StructuredSerializeWithTransfer$](|frame|, « |data| »).
145-
1. Let |frameCopy| be [$StructuredDeserialize$](|serializedFrame|, |frame|'s [=relevant realm=]).
145+
1. Let |frameCopy| be [$StructuredDeserializeWithTransfer$](|serializedFrame|, |frame|'s [=relevant realm=]).
146146
1. Enqueue |frameCopy| for processing as if it came directly from the encoded data source, by running one of the following steps:
147147
* If |rtcObject| is a {{RTCRtpSender}}, enqueue |frameCopy| to |rtcObject|'s packetizer, to be processed [=in parallel=].
148148
* If |rtcObject| is a {{RTCRtpReceiver}}, enqueue |frameCopy| it to |rtcObject|'s decoder, to be processed [=in parallel=].
@@ -371,7 +371,7 @@ dictionary RTCEncodedVideoFrameMetadata {
371371
<dd>
372372
<p>
373373
An identifier for the encoded frame, monotonically increasing in decode order. Its lower
374-
16 bits match the frame_number of the AV1 Dependency Descriptor Header Extension defined in Appendix A of [[?AV1-RTP-SPEC]], if present.
374+
16 bits match the frame_number of the AV1 Dependency Descriptor Header Extension defined in Appendix A of [[AV1-RTP-SPEC]], if present.
375375
Only present for received frames if the Dependency Descriptor Header Extension is present.
376376
</p>
377377
</dd>
@@ -381,7 +381,7 @@ dictionary RTCEncodedVideoFrameMetadata {
381381
<dd>
382382
<p>
383383
List of frameIds of frames this frame references.
384-
Only present for received frames if the AV1 Dependency Descriptor Header Extension defined in Appendix A of [[?AV1-RTP-SPEC]] is present.
384+
Only present for received frames if the AV1 Dependency Descriptor Header Extension defined in Appendix A of [[AV1-RTP-SPEC]] is present.
385385
</p>
386386
</dd>
387387
<dt>
@@ -460,7 +460,7 @@ interface RTCEncodedVideoFrame {
460460
};
461461
</pre>
462462

463-
### Constructor ### {#RTCEncodedVideoFrame-members}
463+
### Constructor ### {#RTCEncodedVideoFrame-constructor}
464464
<dl dfn-for="RTCEncodedVideoFrame" class="dictionary-members">
465465
<dt>
466466
<dfn for="RTCEncodedVideoFrame" method>constructor()</dfn>
@@ -506,11 +506,13 @@ interface RTCEncodedVideoFrame {
506506
{{RTCEncodedVideoFrameMetadata/mimeType}}.
507507
For <a href="https://w3c.github.io/webrtc-svc/">SVC</a>, each spatial layer
508508
is transformed separately.
509-
<p class="note">
509+
</p>
510+
<p class="note">
510511
Since packetizers may drop certain elements, e.g. AV1 temporal delimiter OBUs,
511512
the input to an receive-side transform may be different from the output of
512513
a send-side transform.
513-
</p>
514+
</p>
515+
<p>
514516
The following table gives a number of examples:
515517
</p>
516518
<table class="simple">
@@ -582,19 +584,20 @@ interface RTCEncodedVideoFrame {
582584

583585
### Serialization ### {#RTCEncodedVideoFrame-serialization}
584586

585-
{{RTCEncodedVideoFrame}} objects are serializable objects [[HTML]].
587+
{{RTCEncodedVideoFrame}} objects are [=serializable objects=].
586588
Their [=serialization steps=], given |value|, |serialized|, and |forStorage|, are:
587589

588590
1. If |forStorage| is true, then throw a {{DataCloneError}}.
589-
1. Set |serialized|.`[[type]]` to the value of |value|.{{RTCEncodedVideoFrame/type}}
591+
1. Set |serialized|.`[[type]]` to the value of |value|.{{RTCEncodedVideoFrame/type}}.
590592
1. Set |serialized|.`[[metadata]]` to an internal representation of |value|'s metadata.
591-
1. Set |serialized|.`[[data]]` to |value|.`[[data]]`
593+
1. Set |serialized|.`[[data]]` to the [=sub-serialization=] of |value|.`[[data]]`.
594+
592595

593596
Their [=deserialization steps=], given |serialized|, |value| and |realm|, are:
594597

595-
1. Set |value|.{{RTCEncodedVideoFrame/type}} to |serialized|.`[[type]]`
596-
1. Set |value|'s metadata to the platform object representation of |serialized|.`[[metadata]]`
597-
1. Set |value|.`[[data]]` to |serialized|.`[[data]]`.
598+
1. Set |value|.{{RTCEncodedVideoFrame/type}} to |serialized|.`[[type]]`.
599+
1. Set |value|'s metadata to the platform object representation of |serialized|.`[[metadata]]`.
600+
1. Set |value|.`[[data]]` to the [=sub-deserialization=] of |serialized|.`[[data]]`.
598601

599602
<p class="note">
600603
The internal form of a serialized RTCEncodedVideoFrame is not observable;
@@ -689,7 +692,7 @@ interface RTCEncodedAudioFrame {
689692
};
690693
</pre>
691694

692-
### Constructor ### {#RTCEncodedAudioFrame-members}
695+
### Constructor ### {#RTCEncodedAudioFrame-constructor}
693696
<dl dfn-for="RTCEncodedAudioFrame" class="dictionary-members">
694697
<dt>
695698
<dfn for="RTCEncodedAudioFrame" method>constructor()</dfn>
@@ -808,17 +811,17 @@ interface RTCEncodedAudioFrame {
808811

809812
### Serialization ### {#RTCEncodedAudioFrame-serialization}
810813

811-
{{RTCEncodedAudioFrame}} objects are serializable objects [[HTML]].
814+
{{RTCEncodedAudioFrame}} objects are [=serializable objects=].
812815
Their [=serialization steps=], given |value|, |serialized|, and |forStorage|, are:
813816

814817
1. If |forStorage| is true, then throw a {{DataCloneError}}.
815818
1. Set |serialized|.`[[metadata]]` to an internal representation of |value|'s metadata.
816-
1. Set |serialized|.`[[data]]` to |value|.`[[data]]`
819+
1. Set |serialized|.`[[data]]` to the [=sub-serialization=] of |value|.`[[data]]`.
817820

818821
Their [=deserialization steps=], given |serialized|, |value| and |realm|, are:
819822

820823
1. Set |value|'s metadata to the platform object representation of |serialized|.`[[metadata]]`
821-
1. Set |value|.`[[data]]` to |serialized|.`[[data]]`.
824+
1. Set |value|.`[[data]]` to the [=sub-deserialization=] of |serialized|.`[[data]]`.
822825

823826
## Interfaces ## {#RTCRtpScriptTransformer-interfaces}
824827
<pre class="idl">
@@ -867,9 +870,9 @@ The <dfn constructor for="RTCRtpScriptTransform" lt="RTCRtpScriptTransform(worke
867870
6. Let |serializedReadable| be the result of [$StructuredSerializeWithTransfer$](|t1|.`[[readable]]`, « |t1|.`[[readable]]` »).
868871
7. Let |serializedWritable| be the result of [$StructuredSerializeWithTransfer$](|t2|.`[[writable]]`, « |t2|.`[[writable]]` »).
869872
8. [=Queue a task=] on the DOM manipulation [=task source=] |worker|'s global scope to run the following steps:
870-
1. Let |transformerOptions| be the result of [$StructuredDeserialize$](|serializedOptions|, the current Realm).
871-
2. Let |readable| be the result of [$StructuredDeserialize$](|serializedReadable|, the current Realm).
872-
3. Let |writable| be the result of [$StructuredDeserialize$](|serializedWritable|, the current Realm).
873+
1. Let |transformerOptions| be the result of [$StructuredDeserializeWithTransfer$](|serializedOptions|, the current Realm).
874+
2. Let |readable| be the result of [$StructuredDeserializeWithTransfer$](|serializedReadable|, the current Realm).
875+
3. Let |writable| be the result of [$StructuredDeserializeWithTransfer$](|serializedWritable|, the current Realm).
873876
4. Let |transformer| be a new {{RTCRtpScriptTransformer}}.
874877
5. Set |transformer|.`[[options]]` to |transformerOptions|.
875878
6. Set |transformer|.`[[readable]]` to |readable|.

0 commit comments

Comments
 (0)