You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -364,9 +378,30 @@ The <dfn constructor for="RTCRtpScriptTransform" lt="RTCRtpScriptTransform(worke
364
378
365
379
// FIXME: Describe error handling (worker closing flag true at RTCRtpScriptTransform creation time. And worker being terminated while transform is processing data).
366
380
381
+
Each RTCRtpScriptTransform has the following set of [=association steps=], given |rtcObject|:
382
+
1. Let |transform| be the {{RTCRtpScriptTransform}} object that owns the [=association steps=].
383
+
1. Let |encoder| be |rtcObject|'s encoder if |rtcObject| is a {{RTCRtpSender}} or undefined otherwise.
384
+
1. Let |depacketizer| be |rtcObject|'s depacketizer if |rtcObject| is a {{RTCRtpReceiver}} or undefined otherwise.
385
+
1. [=Queue a task=] on the DOM manipulation [=task source=] |worker|'s global scope to run the following steps:
386
+
1. Let |transformer| be the {{RTCRtpScriptTransformer}} object associated to |transform|.
387
+
1. Set |transformer|.`[[encoder]]` to |encoder|.
388
+
1. Set |transformer|.`[[depacketizer]]` to |depacketizer|.
389
+
390
+
The <dfn method for="RTCRtpScriptTransformer">generateKeyFrame(|rids|)</dfn> method steps are:
391
+
1. Let |promise| be a new promise.
392
+
1. [=In parallel=], run the [=generate key frame algorithm=] with |promise|, |this|.`[[encoder]]` and |rids|.
393
+
1. Return |promise|.
394
+
395
+
The <dfn method for="RTCRtpScriptTransformer">requestKeyFrame()</dfn> method steps are:
396
+
1. Let |promise| be a new promise.
397
+
1. [=In parallel=], run the [=request key frame algorithm=] with |promise| and |this|.`[[depacketizer]]`.
A RTCRtpScriptTransformer has three private slots called `[[options]]`, `[[readable]]` and `[[writable]]`.
402
+
A {{RTCRtpScriptTransformer}} has the following private slots called `[[depacketizer]]`, `[[encoder]]`, `[[options]]`, `[[readable]]` and `[[writable]]`.
403
+
In addition, a {{RTCRtpScriptTransformer}} is always associated with its parent {{RTCRtpScriptTransform}} transform.
404
+
This allows algorithms to go from an {{RTCRtpScriptTransformer}} object to its {{RTCRtpScriptTransform}} parent and vice versa.
370
405
371
406
The <dfn attribute for="RTCRtpScriptTransformer">options</dfn> getter steps are:
372
407
1. Return [=this=].`[[options]]`.
@@ -377,6 +412,44 @@ The <dfn attribute for="RTCRtpScriptTransformer">readable</dfn> getter steps are
377
412
The <dfn attribute for="RTCRtpScriptTransformer">writable</dfn> getter steps are:
378
413
1. Return [=this=].`[[writable]]`.
379
414
415
+
## KeyFrame Algorithms ## {#KeyFrame-algorithms}
416
+
417
+
The <dfn>generate key frame algorithm</dfn>, given |promise|, |encoder| and |rids|, is defined by running these steps:
418
+
1. If |encoder| is undefined, reject |promise| with {{InvalidStateError}}, abort these steps.
419
+
1. If |rids| is defined, validate each of the RID values in |rids|.
420
+
If any RID value is invalid, reject |promise| with {{NotAllowedError}} and abort these steps.
421
+
1. Gather a list of video encoders, named |videoEncoders| from |encoder|.
422
+
1. If |rids| is not empty, remove from |videoEncoders| any video encoder that does not match a value in |rids|.
423
+
1. If |videoEncoders| is empty, reject |promise| with {{NotFoundError}} and abort these steps.
424
+
|videoEncoders| is expected to be empty if the corresponding {{RTCRtpSender}} is not active, or the corresponding {{RTCRtpSender}} track is ended.
425
+
1. For each |videoEncoder| in |videoEncoders|, instruct |videoEncoder| to generate a key frame for the next provided video frame.
426
+
1. Wait until a new video frame is provided to each |videoEncoder| in |videoEncoders|.
427
+
1. [=Resolve=] |promise| with undefined.
428
+
429
+
The <dfn>request key frame algorithm</dfn>, given |promise| and |depacketizer|, is defined by running these steps:
430
+
1. If |depacketizer| is undefined, reject |promise| with {{InvalidStateError}}, abort these steps.
431
+
1. If sending a Full Intra Request (FIR) by |depacketizer|'s receiver is not deemed appropriate, [=resolve=] |promise| with undefined and abort these steps.
432
+
Section 4.3.1 of [[RFC-5104]] provides guidelines of how and when it is appropriate to sending a Full Intra Request.
433
+
1. Generate a Full Intra Request (FIR) packet as defined in section 4.3.1 of [[RFC-5104]] and send it through |depacketizer|'s receiver.
0 commit comments