Skip to content

Commit 0647bf5

Browse files
authored
Added use cases and efficiency opportunities
1 parent af03095 commit 0647bf5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

explainer.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ and a decoder.
3434

3535
The encoder is an object that takes a Stream(raw frames) and emits a Stream(encoded frames). It will also have API surface for non-data interfaces like asking the encoder to produce a keyframe, or setting the normal keyframe interval, target bitrate and so on.
3636

37+
## Use cases
38+
The use cases for this API include the following cases from the [WebRTC NV use cases](https://www.w3.org/TR/webrtc-nv-use-cases/) document:
39+
* Funny Hats (pre-processing inserted before codec)
40+
* Background removal
41+
* Voice processing
42+
* Secure Web conferencing with trusted Javascript (from [the pull request](https://github.com/w3c/webrtc-nv-use-cases/pull/49))
43+
44+
In addition, the following use cases can be addressed because the codec's dynamic parameters are exposed to the application):
45+
* Dynamic control of codec parameters
46+
* App-defined bandwidth distribution between tracks
47+
48+
When it's possible to replace the returned codec with a completely custom codec, we can address:
49+
* Custom codec for special purposes
50+
51+
3752
## Code examples
3853

3954
In order to insert your own processing in the media pipeline, do the following:
@@ -91,3 +106,8 @@ pc = new RTCPeerConnection({
91106
}
92107
})});
93108
</pre>
109+
110+
## Implementation efficiency opportunities
111+
The API outlined here gives the implementation lots of opportunity to optimize. For instance, when the UA discovers that it has been asked to run a pipe from an internal encoder to an internal RTP sender, it has no need to convert the data into the Javascript format, since it is never going to be exposed to Javascript, and does not need to switch to the thread on which Javascript is running.
112+
113+
Similarly, piping from a MediaStreamTrack created on the main thread to a processing step that is executing in a worker has no need to touch the main thread; the media buffers can be piped directly to the worker.

0 commit comments

Comments
 (0)