Skip to content

Commit fc9355e

Browse files
committed
Default the generate key frame algorithm to all layers.
1 parent 9cf200f commit fc9355e

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

index.bs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,26 +1003,39 @@ The <dfn abstract-op>generate key frame algorithm</dfn>, given |promise|, |encod
10031003
in Section 10 of [[!RFC8851]], then reject |promise| with {{TypeError}} and abort
10041004
these steps.
10051005
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+
10091016
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|.
10141023
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]]`.
10171026
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.
10191029

10201030
For any {{RTCRtpScriptTransformer}} named |transformer|, the following steps are run just before any |frame| is enqueued in |transformer|.`[[readable]]`:
10211031
1. Let |encoder| be |transformer|.`[[encoder]]`.
10221032
1. If |encoder| or |encoder|.`[[pendingKeyFrameTasks]]` is undefined, abort these steps.
10231033
1. If |frame| is not a video {{RTCEncodedVideoFrameType/"key"}} frame, abort these steps.
10241034
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:
10261039
1. Remove |task| from |encoder|.`[[pendingKeyFrameTasks]]`.
10271040
1. Resolve |task|.`[[promise]]` with |frame|'s timestamp.
10281041

0 commit comments

Comments
 (0)