From 8206d75f3fec919abb043f0ae8712383efba83a0 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Tue, 8 Jul 2025 17:12:38 -0400 Subject: [PATCH 1/3] Add interface mixin KeyFrameRequest to simplify --- index.bs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/index.bs b/index.bs index e47097a..9134a3b 100644 --- a/index.bs +++ b/index.bs @@ -885,6 +885,10 @@ partial interface DedicatedWorkerGlobalScope { attribute EventHandler onrtctransform; }; +interface mixin KeyFrameRequest { + Promise<undefined> generateKeyFrame(optional sequence<DOMString> rids); +}; + [Exposed=DedicatedWorker] interface RTCRtpScriptTransformer : EventTarget { // Attributes and methods related to the transformer source @@ -897,6 +901,7 @@ interface RTCRtpScriptTransformer : EventTarget { // Attributes for configuring the Javascript code readonly attribute any options; }; +RTCRtpScriptTransformer includes KeyFrameRequest; [Exposed=Window] interface RTCRtpScriptTransform { @@ -941,11 +946,6 @@ Each RTCRtpScriptTransform has the following set of [$association steps$], given 1. Set |transformer|.`[[encoder]]` to |encoder|. 1. Set |transformer|.`[[depacketizer]]` to |depacketizer|. -The generateKeyFrame(|rid|) method steps are: -1. Let |promise| be a new promise. -1. Run the [$generate key frame algorithm$] with |promise|, |this|.`[[encoder]]` and |rid|. -1. Return |promise|. - The sendKeyFrameRequest() method steps are: 1. Let |promise| be a new promise. 1. Run the [$send request key frame algorithm$] with |promise| and |this|.`[[depacketizer]]`. @@ -988,6 +988,13 @@ or Full Intra Refresh (FIR), queue a task to perform the following steps: 1. If the event's [=Event/canceled flag=] is true, abort these steps. 1. Run the [$generate key frame algorithm$] with a new promise, |transform|.`[[encoder]]` and |rid|. +## KeyFrameRequest Operations ## {#KeyFrameRequest-operations} + +The generateKeyFrame(|rid|) method steps are: +1. Let |promise| be a new promise. +1. Run the [$generate key frame algorithm$] with |promise|, |this|.`[[encoder]]` and |rid|. +1. Return |promise|. + ## KeyFrame Algorithms ## {#KeyFrame-algorithms} The generate key frame algorithm, given |promise|, |encoder| and |rid|, is defined by running these steps: @@ -1038,19 +1045,9 @@ The send request key frame algorithm, given |promise| and An additional API on {{RTCRtpSender}} is added to complement the generation of key frame added to {{RTCRtpScriptTransformer}}.
-partial interface RTCRtpSender {
-    Promise<undefined> generateKeyFrame(optional sequence <DOMString> rids);
-};
+RTCRtpSender includes KeyFrameRequest;
 
-## Extension operation ## {#sender-operation} - -The generateKeyFrame(|rids|) method steps are: - -1. Let |promise| be a new promise. -1. [=In parallel=], run the [$generate key frame algorithm$] with |promise|, |this|'s encoder and |rids|. -1. Return |promise|. - # Privacy and security considerations # {#privacy} This API gives Javascript access to the content of media streams. This From 6445a3188da06f9421a80c8da7451f8b9559e570 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 10 Jul 2025 09:53:56 -0400 Subject: [PATCH 2/3] Forgot to remove duplicate --- index.bs | 1 - 1 file changed, 1 deletion(-) diff --git a/index.bs b/index.bs index 9134a3b..1eb63e7 100644 --- a/index.bs +++ b/index.bs @@ -893,7 +893,6 @@ interface mixin KeyFrameRequest { interface RTCRtpScriptTransformer : EventTarget { // Attributes and methods related to the transformer source readonly attribute ReadableStream readable; - Promise<unsigned long long> generateKeyFrame(optional DOMString rid); Promise<undefined> sendKeyFrameRequest(); // Attributes and methods related to the transformer sink readonly attribute WritableStream writable; From 75e1f411294034a33b63f723db0754fb03a137f3 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 10 Jul 2025 10:36:32 -0400 Subject: [PATCH 3/3] Update index.bs Co-authored-by: youennf --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 1eb63e7..e096e77 100644 --- a/index.bs +++ b/index.bs @@ -886,7 +886,7 @@ partial interface DedicatedWorkerGlobalScope { }; interface mixin KeyFrameRequest { - Promise<undefined> generateKeyFrame(optional sequence<DOMString> rids); + Promise<undefined> generateKeyFrame(optional DOMString rid); }; [Exposed=DedicatedWorker]