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
Copy file name to clipboardExpand all lines: index.bs
+24-11Lines changed: 24 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1003,26 +1003,39 @@ The <dfn abstract-op>generate key frame algorithm</dfn>, given |promise|, |encod
1003
1003
in Section 10 of [[!RFC8851]], then reject |promise| with {{TypeError}} and abort
1004
1004
these steps.
1005
1005
1. [=In parallel=], run the following steps:
1006
-
1. Gather a list of video encoders, named |videoEncoders| from |encoder|, ordered according negotiated RIDs if any.
1007
-
1. If |rid| is defined, remove from |videoEncoders| any video encoder that does not match |rid|.
1008
-
1. If |rid| is undefined, remove from |videoEncoders| all video encoders except the first one.
1006
+
1. Let |videoEncoders| be a list of video encoders from |encoder|, ordered according to their negotiated RIDs if any.
1007
+
1. Let |allRids| be the list of rids from |videoEncoders|, using `null` in place of any missing rids.
1008
+
1. Assert that |allRids| either [=list/contains=] no `null` values or a single entry that is `null`.
1009
+
1010
+
Note: This algorithm internally uses `null` to identify the single video encoder in unicast.
1011
+
1012
+
1. If |rid| is not undefined, remove from |videoEncoders| any video encoder that does not match |rid|.
1013
+
1014
+
Note: If no |rid| is passed in, keyframes are generated for all layers.
1015
+
1009
1016
1. If |videoEncoders| is empty, [=queue a task=] to reject |promise| with {{NotFoundError}} and abort these steps.
1010
-
|videoEncoders| is expected to be empty if the corresponding {{RTCRtpSender}} is not active, or the corresponding {{RTCRtpSender}} track is ended.
1011
-
1. Let |videoEncoder| be the first encoder in |videoEncoders|.
1012
-
1. If |rid| is undefined, set |rid| to the RID value corresponding to |videoEncoder|.
1013
-
1. Create a pending key frame task called |task| with |task|.`[[rid]]` set to rid and |task|.`[[promise]]`| set to |promise|.
1017
+
1018
+
Note: |videoEncoders| is expected to be empty if the corresponding {{RTCRtpSender}} encoding is not
1019
+
{{RTCRtpEncodingParameters/active}}, or the corresponding {{RTCRtpSender}} track is ended.
1020
+
1021
+
1. Let |rids| be [|rid|] if |rid| is not undefined, or |allRids| otherwise.
1022
+
1. Create a pending key frame task called |task| with |task|.`[[rids]]` set to |rids| and |task|.`[[promise]]` set to |promise|.
1014
1023
1. If |encoder|.`[[pendingKeyFrameTasks]]` is undefined, initialize |encoder|.`[[pendingKeyFrameTasks]]` to an empty set.
1015
-
1. Let |shouldTriggerKeyFrame| be <code>false</code> if |encoder|.`[[pendingKeyFrameTasks]]` contains a task whose `[[rid]]`
1016
-
value is equal to |rid|, and <code>true</code> otherwise.
1024
+
1. Remove from |videoEncoders| any video encoder whose identifying |rid| (or `null` value if it has no rid)
1025
+
already [=list/contained|exists=] in any `[[rids]]` of any tasks in |encoder|.`[[pendingKeyFrameTasks]]`.
1017
1026
1. Add |task| to |encoder|.`[[pendingKeyFrameTasks]]`.
1018
-
1. If |shouldTriggerKeyFrame| is <code>true</code>, instruct |videoEncoder| to generate a key frame for the next provided video frame.
1027
+
1. For each |videoEncoder| in |videoEncoders| (if any), instruct |videoEncoder| to generate a key frame for its
1028
+
next provided video frame.
1019
1029
1020
1030
For any {{RTCRtpScriptTransformer}} named |transformer|, the following steps are run just before any |frame| is enqueued in |transformer|.`[[readable]]`:
1021
1031
1. Let |encoder| be |transformer|.`[[encoder]]`.
1022
1032
1. If |encoder| or |encoder|.`[[pendingKeyFrameTasks]]` is undefined, abort these steps.
1023
1033
1. If |frame| is not a video {{RTCEncodedVideoFrameType/"key"}} frame, abort these steps.
1024
1034
1. For each |task| in |encoder|.`[[pendingKeyFrameTasks]]`, run the following steps:
1025
-
1. If |frame| was generated by a video encoder identified by |task|.`[[rid]]`, run the following steps:
1035
+
1. If |frame| was generated by a video encoder identified by a value
1036
+
[=list/contained=] in |task|.`[[rids]]`, and this brings to zero the number of
1037
+
video encoders identified in |task|.`[[rids]]` that still haven't finished
1038
+
generating its keyframe, then run the following steps:
1026
1039
1. Remove |task| from |encoder|.`[[pendingKeyFrameTasks]]`.
1027
1040
1. Resolve |task|.`[[promise]]` with |frame|'s timestamp.
0 commit comments