Skip to content

Commit d5f6808

Browse files
committed
Remove source/sink mixins, define keyframe event algo
1 parent 7c2edc7 commit d5f6808

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

index.bs

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -591,24 +591,24 @@ partial interface DedicatedWorkerGlobalScope {
591591
};
592592

593593
interface mixin RTCRtpScriptSource {
594-
readonly attribute ReadableStream readable;
595-
Promise<unsigned long long> generateKeyFrame(optional DOMString rid);
596-
Promise<undefined> sendKeyFrameRequest();
597594
};
598595

599596
interface mixin RTCRtpScriptSink {
600-
readonly attribute WritableStream writable;
601-
attribute EventHandler onkeyframerequest;
602597
};
603598

604599
[Exposed=DedicatedWorker]
605600
interface RTCRtpScriptTransformer {
601+
// Attributes and methods related to the transformer source
602+
readonly attribute ReadableStream readable;
603+
Promise<unsigned long long> generateKeyFrame(optional DOMString rid);
604+
Promise<undefined> sendKeyFrameRequest();
605+
// Attributes and methods related to the transformer sink
606+
readonly attribute WritableStream writable;
607+
attribute EventHandler onkeyframerequest;
608+
// Attributes for configuring the Javascript code
606609
readonly attribute any options;
607610
};
608611

609-
RTCRtpScriptTransformer includes RTCRtpScriptSource;
610-
RTCRtpScriptTransformer includes RTCRtpScriptSink;
611-
612612
[Exposed=Window]
613613
interface RTCRtpScriptTransform {
614614
constructor(Worker worker, optional any options, optional sequence<object> transfer);
@@ -652,12 +652,12 @@ Each RTCRtpScriptTransform has the following set of [$association steps$], given
652652
1. Set |transformer|.`[[encoder]]` to |encoder|.
653653
1. Set |transformer|.`[[depacketizer]]` to |depacketizer|.
654654

655-
The <dfn method for="RTCRtpScriptSource">generateKeyFrame(|rid|)</dfn> method steps are:
655+
The <dfn method for="RTCRtpScriptTransform">generateKeyFrame(|rid|)</dfn> method steps are:
656656
1. Let |promise| be a new promise.
657657
1. Run the [$generate key frame algorithm$] with |promise|, |this|.`[[encoder]]` and |rid|.
658658
1. Return |promise|.
659659

660-
The <dfn method for="RTCRtpScriptSource">sendKeyFrameRequest()</dfn> method steps are:
660+
The <dfn method for="RTCRtpScriptTransform">sendKeyFrameRequest()</dfn> method steps are:
661661
1. Let |promise| be a new promise.
662662
1. Run the [$send request key frame algorithm$] with |promise| and |this|.`[[depacketizer]]`.
663663
1. Return |promise|.
@@ -671,21 +671,34 @@ This allows algorithms to go from an {{RTCRtpScriptTransformer}} object to its {
671671
The <dfn attribute for="RTCRtpScriptTransformer">options</dfn> getter steps are:
672672
1. Return [=this=].`[[options]]`.
673673

674-
The <dfn attribute for="RTCRtpScriptSource">readable</dfn> getter steps are:
674+
The <dfn attribute for="RTCRtpScriptTransform">readable</dfn> getter steps are:
675675
1. Return [=this=].`[[readable]]`.
676676

677-
The <dfn attribute for="RTCRtpScriptSink">writable</dfn> getter steps are:
677+
The <dfn attribute for="RTCRtpScriptTransform">writable</dfn> getter steps are:
678678
1. Return [=this=].`[[writable]]`.
679679

680-
The <dfn attribute for="RTCRtpScriptSink">onbandwidthestimate</dfn> EventHandler has type bandwidthestimate.
680+
The <dfn attribute for="RTCRtpScriptTransform">onbandwidthestimate</dfn> EventHandler has type bandwidthestimate.
681681

682-
The <dfn attribute for="RTCRtpScriptSink">onkeyframerequest</dfn> EventHandler has type keyframerequest.
682+
The <dfn attribute for="RTCRtpScriptTransform">onkeyframerequest</dfn> EventHandler has type keyframerequest.
683683

684684
## Events ## {#RTCRtpScriptTransformer-events}
685685

686686
The following events fire on an {{RTCRtpScriptTransformer}}:
687687

688-
* keyframerequest of type {{KeyFrameRequestEvent}} - fired when the sink determines that a key frame has been requested. In the context of {{RTCRtpScriptTransform}}, if the event is not cancelled, the information will be passed to the source as if the generateKeyFrame() function had been called. <!-- NOTE IN DRAFT: generateKeyFrame() and requestKeyFrame() should merge -->
688+
* keyframerequest of type {{KeyFrameRequestEvent}} - fired when the sink determines that a key frame has been requested.
689+
690+
The steps that generate an event of type {{KeyFrameRequestEvent}} are as follows:
691+
692+
Given a {{RTCRtpScriptTransformer}} `transform`:
693+
694+
When `transform`'s `[[encoder]]` receives a keyframe request, for instance from an incoming RTCP Picture Loss Indication (PLI)
695+
or Full Intra Refresh (FIR), queue
696+
a task to perform the following steps:
697+
698+
1. Set `rid` to the RID of the appropriate layer, or undefined if the request is not for a specific layer.
699+
1. Fire a cancelable event of type {{KeyFrameRequestEvent}} on `transform`, with {{KeyFrameRequestEvent/rid}} set to `rid`.
700+
1. If the event is cancelled, abort these steps.
701+
1. Run the [$generate key frame algorithm$] with a new promise, `transform`.`[[encoder]]` and `rid`.
689702

690703
## KeyFrame Algorithms ## {#KeyFrame-algorithms}
691704

0 commit comments

Comments
 (0)