-
Notifications
You must be signed in to change notification settings - Fork 28
Default the generate key frame algorithm to all layers. #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ spec:webidl; type:dfn; text:resolve | |
</pre> | ||
<pre class=link-defaults> | ||
spec:streams; type:interface; text:ReadableStream | ||
spec:infra; type:dfn; text:list | ||
</pre> | ||
|
||
# Introduction # {#introduction} | ||
|
@@ -1003,32 +1004,35 @@ The <dfn abstract-op>generate key frame algorithm</dfn>, given |promise|, |encod | |
in Section 10 of [[!RFC8851]], then reject |promise| with {{TypeError}} and abort | ||
these steps. | ||
1. [=In parallel=], run the following steps: | ||
1. Gather a list of video encoders, named |videoEncoders| from |encoder|, ordered according negotiated RIDs if any. | ||
1. If |rid| is defined, remove from |videoEncoders| any video encoder that does not match |rid|. | ||
1. If |rid| is undefined, remove from |videoEncoders| all video encoders except the first one. | ||
1. If |videoEncoders| is empty, [=queue a task=] to reject |promise| with {{NotFoundError}} and abort these steps. | ||
|videoEncoders| is expected to be empty if the corresponding {{RTCRtpSender}} is not active, or the corresponding {{RTCRtpSender}} track is ended. | ||
1. Let |videoEncoder| be the first encoder in |videoEncoders|. | ||
1. If |rid| is undefined, set |rid| to the RID value corresponding to |videoEncoder|. | ||
1. Create a pending key frame task called |task| with |task|.`[[rid]]` set to rid and |task|.`[[promise]]`| set to |promise|. | ||
1. Let |layers| be a new [=list=] of the layers for this |encoder|, ordered by negotiated encoding index. | ||
1. Remove from |layers| all layers that are not {{RTCRtpEncodingParameters/active}}, or whose | ||
corresponding {{RTCRtpSender}} track has ended. | ||
1. If |rid| is not undefined, remove from |layers| all layers whose rid is not |rid|. | ||
|
||
Note: If no |rid| is passed in, keyframes are generated for all active layers. | ||
|
||
1. If |layers| is now empty, [=queue a task=] to reject |promise| with {{NotFoundError}} and abort these steps. | ||
1. Create a pending key frame task called |task| with |task|.`[[layers]]` set to |layers| and |task|.`[[promise]]` set to |promise|. | ||
1. If |encoder|.`[[pendingKeyFrameTasks]]` is undefined, initialize |encoder|.`[[pendingKeyFrameTasks]]` to an empty set. | ||
1. Let |shouldTriggerKeyFrame| be <code>false</code> if |encoder|.`[[pendingKeyFrameTasks]]` contains a task whose `[[rid]]` | ||
value is equal to |rid|, and <code>true</code> otherwise. | ||
1. Remove from |layers| all layers already [=list/contained|found=] in any `[[layers]]` of any tasks in |encoder|.`[[pendingKeyFrameTasks]]`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can do that step first before creating the pending key frame task. |
||
1. Add |task| to |encoder|.`[[pendingKeyFrameTasks]]`. | ||
1. If |shouldTriggerKeyFrame| is <code>true</code>, instruct |videoEncoder| to generate a key frame for the next provided video frame. | ||
1. For each |layer| in |layers| (if any), instruct |encoder| to generate a key frame for its | ||
next provided video frame to that |layer|. | ||
|
||
For any {{RTCRtpScriptTransformer}} named |transformer|, the following steps are run just before any |frame| is enqueued in |transformer|.`[[readable]]`: | ||
1. Let |encoder| be |transformer|.`[[encoder]]`. | ||
1. If |encoder| or |encoder|.`[[pendingKeyFrameTasks]]` is undefined, abort these steps. | ||
1. If |frame| is not a video {{RTCEncodedVideoFrameType/"key"}} frame, abort these steps. | ||
1. For each |task| in |encoder|.`[[pendingKeyFrameTasks]]`, run the following steps: | ||
1. If |frame| was generated by a video encoder identified by |task|.`[[rid]]`, run the following steps: | ||
1. If |frame| was generated for a layer | ||
[=list/contained=] in |task|.`[[layers]]`, remove that layer from |task|.`[[layers]]`. | ||
If this causes |task|.`[[layers]]` to become empty, then run the following steps: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's resolve the promise as soon as we have a frame, that way, whether there are multiple key frames or just one, it is consistent. |
||
1. Remove |task| from |encoder|.`[[pendingKeyFrameTasks]]`. | ||
1. Resolve |task|.`[[promise]]` with |frame|'s timestamp. | ||
|
||
By resolving the promises just before enqueuing the corresponding key frame in a {{RTCRtpScriptTransformer}}'s readable, | ||
the resolution callbacks of the promises are always executed just before the corresponding key frame is exposed. | ||
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. | ||
If the promise is associated with several layers, it will be resolved once key frames have been enqueued for all of them. | ||
|
||
The <dfn abstract-op>send request key frame algorithm</dfn>, given |promise| and |depacketizer|, is defined by running these steps: | ||
1. If |depacketizer| is undefined, reject |promise| with {{InvalidStateError}}, abort these steps. | ||
|
Uh oh!
There was an error while loading. Please reload this page.