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
@@ -1003,45 +1004,35 @@ The <dfn abstract-op>generate key frame algorithm</dfn>, given |promise|, |encod
1003
1004
in Section 10 of [[!RFC8851]], then reject |promise| with {{TypeError}} and abort
1004
1005
these steps.
1005
1006
1. [=In parallel=], run the following steps:
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`.
1007
+
1. Let |layers| be a new [=list=] of the layers for this |encoder|, ordered by negotiated encoding index.
1008
+
1. Remove from |layers| all layers that are not {{RTCRtpEncodingParameters/active}}, or whose
1009
+
corresponding {{RTCRtpSender}} track has ended.
1010
+
1. If |rid| is not undefined, remove from |layers| all layers whose rid is not |rid|.
1009
1011
1010
-
Note: This algorithm internally uses `null` to identify the single video encoder in unicast.
1012
+
Note: If no |rid| is passed in, keyframes are generated for all active layers.
1011
1013
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
-
1016
-
1. If |videoEncoders| is empty, [=queue a task=] to reject |promise| with {{NotFoundError}} and abort these steps.
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
+
1. If |layers| is now empty, [=queue a task=] to reject |promise| with {{NotFoundError}} and abort these steps.
1015
+
1. Create a pending key frame task called |task| with |task|.`[[layers]]` set to |layers| and |task|.`[[promise]]` set to |promise|.
1023
1016
1. If |encoder|.`[[pendingKeyFrameTasks]]` is undefined, initialize |encoder|.`[[pendingKeyFrameTasks]]` to an empty set.
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
+
1. Remove from |layers| all layers already [=list/contained|found=] in any `[[layers]]` of any tasks in |encoder|.`[[pendingKeyFrameTasks]]`.
1026
1018
1. Add |task| to |encoder|.`[[pendingKeyFrameTasks]]`.
1027
-
1. For each |videoEncoder| in |videoEncoders| (if any), instruct |videoEncoder| to generate a key frame for its
1028
-
next provided video frame.
1019
+
1. For each |layer| in |layers| (if any), instruct |encoder| to generate a key frame for its
1020
+
next provided video frame to that |layer|.
1029
1021
1030
1022
For any {{RTCRtpScriptTransformer}} named |transformer|, the following steps are run just before any |frame| is enqueued in |transformer|.`[[readable]]`:
1031
1023
1. Let |encoder| be |transformer|.`[[encoder]]`.
1032
1024
1. If |encoder| or |encoder|.`[[pendingKeyFrameTasks]]` is undefined, abort these steps.
1033
1025
1. If |frame| is not a video {{RTCEncodedVideoFrameType/"key"}} frame, abort these steps.
1034
1026
1. For each |task| in |encoder|.`[[pendingKeyFrameTasks]]`, 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:
1027
+
1. If |frame| was generated for a layer
1028
+
[=list/contained=] in |task|.`[[layers]]`, remove that layer from |task|.`[[layers]]`.
1029
+
If this causes |task|.`[[layers]]` to become empty, then run the following steps:
1039
1030
1. Remove |task| from |encoder|.`[[pendingKeyFrameTasks]]`.
1040
1031
1. Resolve |task|.`[[promise]]` with |frame|'s timestamp.
1041
1032
1042
1033
By resolving the promises just before enqueuing the corresponding key frame in a {{RTCRtpScriptTransformer}}'s readable,
1043
1034
the resolution callbacks of the promises are always executed just before the corresponding key frame is exposed.
1044
-
If the promise is associated to several rid values, it will be resolved when the first key frame corresponding to one the rid value is enqueued.
1035
+
If the promise is associated with several layers, it will be resolved once key frames have been enqueued for all of them.
1045
1036
1046
1037
The <dfn abstract-op>send request key frame algorithm</dfn>, given |promise| and |depacketizer|, is defined by running these steps:
1047
1038
1. If |depacketizer| is undefined, reject |promise| with {{InvalidStateError}}, abort these steps.
0 commit comments