MediaStreamTrack Insertable Media Processing using Streams

Editor’s Draft,

More details about this document
This version:
https://w3c.github.io/mediacapture-transform/
Latest published version:
https://www.w3.org/TR/mediacapture-transform/
Feedback:
public-webrtc@w3.org with subject line “[mediacapture-transform] … message topic …” (archives)
GitHub
Editors:
(Google)
(Google)

Abstract

This API defines an API surface for manipulating the bits on MediaStreamTracks carrying raw data.

Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

If you wish to make comments regarding this document, please send them to public-webrtc@w3.org (subscribe, archives). When sending e-mail, please put the text “mediacapture-transform” in the subject, preferably like this: “[mediacapture-transform] …summary of comment…”. All comments are welcome.

This document was produced by the Web Real-Time Communications Working Group.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 03 November 2023 W3C Process Document.

1. Introduction

The [WEBRTC-NV-USE-CASES] document describes several functions that can only be achieved by access to media (requirements N20-N22), including, but not limited to:

These use cases further require that processing can be done in worker threads (requirement N23-N24).

This specification gives an interface based on [WEBCODECS] and [STREAMS] to provide access to such functionality.

This specification provides access to raw media, which is the output of a media source such as a camera, microphone, screen capture, or the decoder part of a codec and the input to the decoder part of a codec. The processed media can be consumed by any destination that can take a MediaStreamTrack, including HTML <video> tags, RTCPeerConnection, canvas or MediaRecorder.

This specification explicitly aims to support the following use cases:

Note: There is no WG consensus on whether or not audio use cases should be supported.

Note: The WG expects that the Streams spec will adopt the solutions outlined in the relevant explainer, to solve some issues with the current Streams specification.

2. Specification

This specification shows the IDL extensions for [MEDIACAPTURE-STREAMS]. It defines some new objects that inherit the MediaStreamTrack interface, and can be constructed from a MediaStreamTrack.

The API consists of two elements. One is a track sink that is capable of exposing the unencoded media frames from the track to a ReadableStream. The other one is the inverse of that: it provides a track source that takes media frames as input.

2.1. MediaStreamTrackProcessor

A MediaStreamTrackProcessor allows the creation of a ReadableStream that can expose the media flowing through a given MediaStreamTrack. If the MediaStreamTrack is a video track, the chunks exposed by the stream will be VideoFrame objects.

This makes MediaStreamTrackProcessor effectively a sink in the MediaStream model.

A MediaStreamTrackProcessor internally contains a circular queue that allows buffering incoming media frames delivered by the track it is connected to. This buffering allows the MediaStreamTrackProcessor to temporarily hold frames waiting to be read from its associated ReadableStream. The application can influence the maximum size of the queue via a parameter provided in the MediaStreamTrackProcessor constructor. However, the maximum size of the queue is decided by the UA and can change dynamically, but it will not exceed the size requested by the application. If the application does not provide a maximum size parameter, the UA is free to decide the maximum size of the queue.

When a new frame arrives to the MediaStreamTrackProcessor, if the queue has reached its maximum size, the oldest frame will be removed from the queue, and the new frame will be added to the queue. This means that for the particular case of a queue with a maximum size of 1, if there is a queued frame, it will aways be the most recent one.

The UA is also free to remove any frames from the queue at any time. The UA may remove frames in order to save resources or to improve performance in specific situations. In all cases, frames that are not dropped must be made available to the ReadableStream in the order in which they arrive to the MediaStreamTrackProcessor.

A MediaStreamTrackProcessor makes frames available to its associated ReadableStream only when a read request has been issued on the stream. The idea is to avoid the stream’s internal buffering, which does not give the UA enough flexibility to choose the buffering policy.

2.1.1. Interface definition

[Exposed=DedicatedWorker]
interface MediaStreamTrackProcessor {
    constructor(MediaStreamTrackProcessorInit init);
    readonly attribute ReadableStream readable;
};

dictionary MediaStreamTrackProcessorInit {
  required MediaStreamTrack track;
  [EnforceRange] unsigned short maxBufferSize;
};

Note: There is WG consensus that the interface should be exposed on DedicatedWorker. There is no WG consensus on whether or not the interface should not be exposed on Window.

Note: There is consensus in the WG that creating a MediaStreamTrackProcessor from a MediaStreamTrack of kind "video" should exist. There is no WG consensus on whether or not creating a MediaStreamTrackProcessor from a MediaStreamTrack of kind "audio" should be supported.

2.1.2. Internal slots

[[track]]
Track whose raw data is to be exposed by the MediaStreamTrackProcessor.
[[maxBufferSize]]
The maximum number of media frames to be buffered by the MediaStreamTrackProcessor as specified by the application. It may have no value if the application does not provide it. Its minimum valid value is 1.
[[queue]]
A queue used to buffer media frames not yet read by the application
[[numPendingReads]]
An integer whose value represents the number of read requests issued by the application that have not yet been handled.
[[isClosed]]
An boolean whose value indicates if the MediaStreamTrackProcessor is closed.

2.1.3. Constructor

MediaStreamTrackProcessor(init)
  1. If init.track is not a valid MediaStreamTrack, throw a TypeError.

  2. Let maxBufferSize be 1.

  3. If init.maxBufferSize has an integer value greater than 1, run the following substeps:

    1. Set maxBufferSize to init.maxBufferSize.

    2. The user agent MAY decide to clamp maxBufferSize to a lower value, but no lower than 1.

      Clamping maxBufferSize can be useful for some sources like cameras, for instance in case they can only use a limited number of VideoFrames at any given time.

  4. Let processor be a new MediaStreamTrackProcessor object.

  5. Set processor.[[track]] to init.track.

  6. Set processor.[[maxBufferSize]] to maxBufferSize.

  7. Set processor.[[queue]] to an empty queue.

  8. Set processor.[[numPendingReads]] to 0.

  9. Set processor.[[isClosed]] to false.

  10. Return processor.

2.1.4. Attributes

readable, of type ReadableStream, readonly
Allows reading the frames delivered by the MediaStreamTrack stored in the [[track]] internal slot. This attribute is created the first time it is invoked according to the following steps:
  1. Initialize this.readable to be a new ReadableStream.

  2. Set up this.readable with its pullAlgorithm set to processorPull with this as parameter, cancelAlgorithm set to processorCancel with this as parameter, and highWatermark set to 0.

The processorPull algorithm is given a processor as input. It is defined by the following steps:

  1. Increment the value of the processor.[[numPendingReads]] by 1.

  2. Queue a task to run the maybeReadFrame algorithm with processor as parameter.

  3. Return a promise resolved with undefined.

The maybeReadFrame algorithm is given a processor as input. It is defined by the following steps:

  1. If processor.[[queue]] is empty, abort these steps.

  2. If processor.[[numPendingReads]] equals zero, abort these steps.

  3. Let frame be the result of dequeueing a frame media data from processor.[[queue]].

  4. Enqueue frame in processor.readable.

  5. Decrement processor.[[numPendingReads]] by 1.

  6. Go to step 1.

The processorCancel algorithm is given a processor as input. It is defined by running the following steps:

  1. Run the processorClose algorithm with processor as parameter.

  2. Return a promise resolved with undefined.

The processorClose algorithm is given a processor as input. It is defined by running the following steps:

  1. If processor.[[isClosed]] is true, abort these steps.

  2. Disconnect processor from processor.[[track]]. The mechanism to do this is UA specific and the result is that processor is no longer a sink of processor.[[track]].

  3. Close processor.readable.[[controller]].

  4. Empty processor.[[queue]].

  5. Set processor.[[isClosed]] to true.

2.1.5. Handling interaction with the track

When the [[track]] of a MediaStreamTrackProcessor processor delivers a frame to processor, the UA MUST execute the handleNewFrame algorithm with processor as parameter.

The handleNewFrame algorithm is given a processor as input. It is defined by running the following steps:

  1. If processor.[[queue]] has processor.[[maxBufferSize]] elements, run the following steps:

    1. Let droppedFrame be the result of dequeueing processor.[[queue]].

    2. Run the Close VideoFrame algorithm with droppedFrame.

  2. Enqueue the new frame media data in processor.[[queue]].

  3. Queue a task to run the maybeReadFrame algorithm with processor as parameter.

At any time, the UA MAY remove any frame from processor.[[queue]]. The UA may decide to remove frames from processor.[[queue]], for example, to prevent resource exhaustion or to improve performance in certain situations.

The application may detect that frames have been dropped by noticing that there is a gap in the timestamps of the frames.

When the [[track]] of a MediaStreamTrackProcessor processor ends, the processorClose algorithm must be executed with processor as parameter.

2.2. VideoTrackGenerator

A VideoTrackGenerator allows the creation of a video source for a MediaStreamTrack in the MediaStream model that generates its frames from a Stream of VideoFrame objects. It has two readonly attributes: a writable WritableStream and a track MediaStreamTrack.

The VideoTrackGenerator is the underlying sink] of its writable attribute. The track attribute is the output. Further tracks connected to the same VideoTrackGenerator can be created using the clone method on the track attribute.

The WritableStream accepts VideoFrame objects. When a VideoFrame is written to writable, the frame’s close() method is automatically invoked, so that its internal resources are no longer accessible from JavaScript.

Note: There is consensus in the WG that a source capable of generating a MediaStreamTrack of kind "video" should exist. There is no WG consensus on whether or not a source capable of generating a MediaStreamTrack of kind "audio" should exist.

2.2.1. Interface definition

[Exposed=DedicatedWorker]
interface VideoTrackGenerator {
  constructor();
  readonly attribute WritableStream writable;
  attribute boolean muted;
  readonly attribute MediaStreamTrack track;
};

Note: There is WG consensus that this interface should be exposed on DedicatedWorker. There is no WG consensus on whether or not it should be exposed on Window.

2.2.2. Internal slots

[[track]]
The MediaStreamTrack output of this source
[[isMuted]]
A boolean whose value indicates whether this source and all the MediaStreamTracks it sources, are currently muted or not.

2.2.3. Constructor

VideoTrackGenerator()
  1. Let generator be a new VideoTrackGenerator object.

  2. Let track be a newly created MediaStreamTrack with source set to generator and tieSourceToContext set to false.

  3. Initialize generator.track to track.

  4. Return generator.

2.2.4. Attributes

writable, of type WritableStream, readonly
Allows writing video frames to the VideoTrackGenerator. When this attribute is accessed for the first time, it MUST be initialized with the following steps:
  1. Initialize this.writable to be a new WritableStream.

  2. Set up this.writable, with its writeAlgorithm set to writeFrame with this as parameter, with closeAlgorithm set to closeWritable with this as parameter and abortAlgorithm set to closeWritable with this as parameter.

The writeFrame algorithm is given a generator and a frame as input. It is defined by running the following steps:

  1. If frame is not a VideoFrame object, return a promise rejected with a TypeError.

  2. If the value of frame’s [[Detached]] internal slot is true, return a promise rejected with a TypeError.

  3. If generator.[[isMuted]] is false, for each live track sourced from generator, named track, run the following steps:

    1. Let clone be the result of running the Clone videoFrame algorithm with frame.

    2. Send clone to track.

  4. Run the Close VideoFrame algorithm with frame.

  5. Return a promise resolved with undefined.

When the media data is sent to a track, the UA may apply processing (e.g., cropping and downscaling) to ensure that the media data sent to the track satisfies the track’s constraints. Each track may receive a different version of the media data depending on its constraints.

The closeWritable algorithm is given a generator as input. It is defined by running the following steps.

  1. For each track t sourced from generator, end t.

  2. Return a promise resolved with undefined.

muted, of type boolean
Mutes the VideoTrackGenerator. The getter steps are to return this.[[isMuted]]. The setter steps, given a value newValue, are as follows:
  1. If newValue is equal to this.[[isMuted]], abort these steps.

  2. Set this.[[isMuted]] to newValue.

  3. Unless one has been queued already this run of the event loop, queue a task to run the following steps:

    1. Let settledValue be this.[[isMuted]].

    2. For each live track sourced by this, queue a task to set a track’s muted state to settledValue.

track, of type MediaStreamTrack, readonly
The MediaStreamTrack output. The getter steps are to return this.[[track]].

2.2.5. Specialization of MediaStreamTrack behavior

A VideoTrackGenerator acts as the source for one or more MediaStreamTracks. This section adds clarifications on how a MediaStreamTrack sourced from a VideoTrackGenerator behaves.
2.2.5.1. stop
The stop method stops the track. When the last track sourced from a VideoTrackGenerator ends, that VideoTrackGenerator's writable is closed.
2.2.5.2. Constrainable properties

The following constrainable properties are defined for any MediaStreamTracks sourced from a VideoTrackGenerator:

Property Name Values Notes
width ConstrainULong As a setting, this is the width, in pixels, of the latest frame received by the track. As a capability, max MUST reflect the largest width a VideoFrame may have, and min MUST reflect the smallest width a VideoFrame may have.
height ConstrainULong As a setting, this is the height, in pixels, of the latest frame received by the track. As a capability, max MUST reflect the largest height a VideoFrame may have, and min MUST reflect the smallest height a VideoFrame may have.
frameRate ConstrainDouble As a setting, this is an estimate of the frame rate based on frames recently received by the track. As a capability min MUST be zero and max MUST be the maximum frame rate supported by the system.
aspectRatio ConstrainDouble As a setting, this is the aspect ratio of the latest frame delivered by the track; this is the width in pixels divided by height in pixels as a double rounded to the tenth decimal place. As a capability, min MUST be the smallest aspect ratio supported by a VideoFrame, and max MUST be the largest aspect ratio supported by a VideoFrame.
resizeMode ConstrainDOMString As a setting, this string should be one of the members of VideoResizeModeEnum. The value "none" means that the frames output by the MediaStreamTrack are unmodified versions of the frames written to the writable backing the track, regardless of any constraints. The value "crop-and-scale" means that the frames output by the MediaStreamTrack may be cropped and/or downscaled versions of the source frames, based on the values of the width, height and aspectRatio constraints of the track. As a capability, the values "none" and "crop-and-scale" both MUST be present.

The applyConstraints method applied to a video MediaStreamTrack sourced from a VideoTrackGenerator supports the properties defined above. It can be used, for example, to resize frames or adjust the frame rate of the track. Note that these constraints have no effect on the VideoFrame objects written to the writable of a VideoTrackGenerator, just on the output of the track on which the constraints have been applied. Note also that, since a VideoTrackGenerator can in principle produce media data with any setting for the supported constrainable properties, an applyConstraints call on a track backed by a VideoTrackGenerator will generally not fail with OverconstrainedError unless the given constraints are outside the system-supported range, as reported by getCapabilities.

2.2.5.3. Events and attributes
Events and attributes work the same as for any MediaStreamTrack. It is relevant to note that if the writable stream of a VideoTrackGenerator is closed, all the live tracks connected to it are ended and the ended event is fired on them.

3. Examples

3.1. Video Processing

Consider a face recognition function detectFace(videoFrame) that returns a face position (in some format), and a manipulation function blurBackground(videoFrame, facePosition) that returns a new VideoFrame similar to the given videoFrame, but with the non-face parts blurred. The example also shows the video before and after effects on video elements.
// main.js

const stream = await navigator.mediaDevices.getUserMedia({video:true});
const videoBefore = document.getElementById('video-before');
const videoAfter = document.getElementById('video-after');
videoBefore.srcObject = stream.clone();

const [track] = stream.getVideoTracks();
const worker = new Worker('worker.js');
worker.postMessage({track}, [track]);

const {data} = await new Promise(r => worker.onmessage);
videoAfter.srcObject = new MediaStream([data.track]);

// worker.js

self.onmessage = async ({data: {track}}) => {
  const source = new VideoTrackGenerator();
  parent.postMessage({track: source.track}, [source.track]);

  const {readable} = new MediaStreamTrackProcessor({track});
  const transformer = new TransformStream({
    async transform(frame, controller) {
      const facePosition = await detectFace(frame);
      const newFrame = blurBackground(frame, facePosition);
      frame.close();
      controller.enqueue(newFrame);
    }
  });
  await readable.pipeThrough(transformer).pipeTo(source.writable);
};

3.2. Multi-consumer post-processing with constraints

A common use case is to remove the background from live camera video fed into a video conference, with a live self-view showing the result. It’s desirable for the self-view to have a high frame rate even if the frame rate used for actual sending may dip lower due to back pressure from bandwidth constraints. This can be achieved by applying constraints to a track clone, avoiding having to process twice.
// main.js

const stream = await navigator.mediaDevices.getUserMedia({video:true});
const [track] = stream.getVideoTracks();
const worker = new Worker('worker.js');
worker.postMessage({track}, [track]);

const {data} = await new Promise(r => worker.onmessage);
const selfView = document.getElementById('video-self');
selfView.srcObject = new MediaStream([data.track.clone()]); // 60 fps

await data.track.applyConstraints({width: 320, height: 200, frameRate: 30});
const pc = new RTCPeerConnection(config);
pc.addTrack(data.track); // 30 fps

// worker.js

self.onmessage = async ({data: {track}}) => {
  const source = new VideoTrackGenerator();
  parent.postMessage({track: source.track}, [source.track]);

  const {readable} = new MediaStreamTrackProcessor({track});
  const transformer = new TransformStream({transform: myRemoveBackgroundFromVideo});
  await readable.pipeThrough(transformer).pipeTo(source.writable);
};

3.3. Multi-consumer post-processing with constraints in a worker

Being able to show a higher frame-rate self-view is also relevant when sending video frames over WebTransport in a worker. The same technique above may be used here, except constraints are applied to a track clone in the worker.
// main.js

const stream = await navigator.mediaDevices.getUserMedia({video:true});
const [track] = stream.getVideoTracks();
const worker = new Worker('worker.js');
worker.postMessage({track}, [track]);

const {data} = await new Promise(r => worker.onmessage);
const selfView = document.getElementById('video-self');
selfView.srcObject = new MediaStream([data.track]); // 60 fps

// worker.js

self.onmessage = async ({data: {track}}) => {
  const source = new VideoTrackGenerator();
  const sendTrack = source.track.clone();
  parent.postMessage({track: source.track}, [source.track]);

  await sendTrack.applyConstraints({width: 320, height: 200, frameRate: 30});

  const wt = new WebTransport("https://webtransport.org:8080/up");

  const {readable} = new MediaStreamTrackProcessor({track});
  const transformer = new TransformStream({transform: myRemoveBackgroundFromVideo});
  await readable.pipeThrough(transformer)
    .pipeThrough({writable: source.writable, readable: sendTrack.readable}),
    .pipeThrough(createMyEncodeVideoStream({
      codec: "vp8",
      width: 640,
      height: 480,
      bitrate: 1000000,
    }))
    .pipeThrough(new TransformStream({transform: mySerializer}));
    .pipeTo(wt.createUnidirectionalStream()); // 30 fps
};

The above example avoids using the tee() function to serve multiple consumers, due to its issues with real-time streams.

For brevity, the example also over-simplifies using a WebCodecs wrapper to encode and send video frames over a single WebTransport stream (incurring head-of-line blocking).

4. Implementation advice

This section is informative.

4.1. Use with multiple consumers

There are use cases where the programmer may desire that a single stream of frames is consumed by multiple consumers.

Examples include the case where the result of a background blurring function should be both displayed in a self-view and encoded using a VideoEncoder.

For cases where both consumers are consuming unprocessed frames, and synchronization is not desired, instantianting multiple MediaStreamTrackProcessor objects is a robust solution.

For cases where both consumers intend to convert the result of a processing step into a MediaStreamTrack using a VideoTrackGenerator, for example when feeding a processed stream to both a <video> tag and an RTCPeerConnection, attaching the resulting MediaStreamTrack to multiple sinks may be the most appropriate mechanism.

For cases where the downstream processing takes frames, not streams, the frames can be cloned as needed and sent off to the downstream processing; "clone" is a cheap operation.

When the stream is the output of some processing, and both branches need a Stream object to do further processing, one needs a function that produces two streams from one stream.

However, the standard tee() operation is problematic in this context:

Therefore, the use of tee() with Streams containing media should only be done when fully understanding the implications. Instead, custom elements for splitting streams more appropriate to the use case should be used.

Note: There are issues filed on the Streams spec where the resolution might affect this section: https://github.com/whatwg/streams/issues/1157, https://github.com/whatwg/streams/issues/1156, https://github.com/whatwg/streams/issues/401, https://github.com/whatwg/streams/issues/1186

5. Security and Privacy considerations

This API defines a MediaStreamTrack source and a MediaStreamTrack sink. The security and privacy of the source (VideoTrackGenerator) relies on the same-origin policy. That is, the data VideoTrackGenerator can make available in the form of a MediaStreamTrack must be visible to the document before a VideoFrame object can be constructed and pushed into the VideoTrackGenerator. Any attempt to create VideoFrame objects using cross-origin data will fail. Therefore, VideoTrackGenerator does not introduce any new fingerprinting surface.

The MediaStreamTrack sink introduced by this API (MediaStreamTrackProcessor) exposes MediaStreamTrack the same data that is exposed by other MediaStreamTrack sinks such as WebRTC peer connections, and media elements. The security and privacy of MediaStreamTrackProcessor relies on the security and privacy of the MediaStreamTrack sources of the tracks to which MediaStreamTrackProcessor is connected. For example, camera, microphone and screen-capture tracks rely on explicit use authorization via permission dialogs (see [MEDIACAPTURE-STREAMS] and [SCREEN-CAPTURE]), while element capture and VideoTrackGenerator rely on the same-origin policy.

A potential issue with MediaStreamTrackProcessor is resource exhaustion. For example, a site might hold on to too many open VideoFrame objects and deplete a system-wide pool of GPU-memory-backed frames. UAs can mitigate this risk by limiting the number of pool-backed frames a site can hold. This can be achieved by reducing the maximum number of buffered frames and by refusing to deliver more frames to readable once the budget limit is reached. Accidental exhaustion is also mitigated by automatic closing of VideoFrame objects once they are written to a VideoTrackGenerator.

6. Backwards compatibility with earlier proposals

This section is informative.

Previous proposals for this interface had an API like this:

[Exposed=Window,DedicatedWorker]
interface MediaStreamTrackGenerator : MediaStreamTrack {
    constructor(MediaStreamTrackGeneratorInit init);
    attribute WritableStream writable;  // VideoFrame or AudioData
};

dictionary MediaStreamTrackGeneratorInit {
  required DOMString kind;
};
This interface had the generator for the MediaStreamTrack being an instance of a MediaStreamTrack rather than containing one.

The VideoTrackGenerator can be shimmed on top of MediaStreamTrackGenerator like this:

// Not tested, unlikely to work as written!
class VideoTrackGenerator {
  constructor() {
     this.innerGenerator = new MediaStreamTrackGenerator({kind: 'video'});
     this.writable = this.innerGenerator.writable;
     this.track = this.innerGenerator.clone();
  }
  // Missing: shim for setting of the "muted" attribute.
};

Further description of the previous proposals, including considerations involving processing of audio, can be found in earlier versions of this document.

Note: A link will be placed here pointing to the chrome-96 branch when we have finished moving repos about.

Conformance

Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Conformant Algorithms

Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.

Conformance requirements phrased as algorithms or specific steps can be implemented in any manner, so long as the end result is equivalent. In particular, the algorithms defined in this specification are intended to be easy to understand and are not intended to be performant. Implementers are encouraged to optimize.

Index

Terms defined by this specification

Terms defined by reference

References

Normative References

[CSS-TEXT-4]
Elika Etemad; et al. CSS Text Module Level 4. URL: https://drafts.csswg.org/css-text-4/
[HTML]
Anne van Kesteren; et al. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[INFRA]
Anne van Kesteren; Domenic Denicola. Infra Standard. Living Standard. URL: https://infra.spec.whatwg.org/
[MEDIACAPTURE-STREAMS]
Cullen Jennings; et al. Media Capture and Streams. URL: https://w3c.github.io/mediacapture-main/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
[STREAMS]
Adam Rice; et al. Streams Standard. Living Standard. URL: https://streams.spec.whatwg.org/
[WEBCODECS]
Paul Adenot; Bernard Aboba; Eugene Zemtsov. WebCodecs. URL: https://w3c.github.io/webcodecs/
[WEBIDL]
Edgar Chen; Timothy Gu. Web IDL Standard. Living Standard. URL: https://webidl.spec.whatwg.org/
[WEBRTC]
Cullen Jennings; et al. WebRTC: Real-Time Communication in Browsers. URL: https://w3c.github.io/webrtc-pc/

Informative References

[SCREEN-CAPTURE]
Jan-Ivar Bruaroey; Elad Alon. Screen Capture. URL: https://w3c.github.io/mediacapture-screen-share/
[WEBRTC-NV-USE-CASES]
Bernard Aboba. WebRTC Extended Use Cases. URL: https://w3c.github.io/webrtc-nv-use-cases/
[WEBTRANSPORT]
Bernard Aboba; Nidhi Jaju; Victor Vasiliev. WebTransport. URL: https://w3c.github.io/webtransport/

IDL Index

[Exposed=DedicatedWorker]
interface MediaStreamTrackProcessor {
    constructor(MediaStreamTrackProcessorInit init);
    readonly attribute ReadableStream readable;
};

dictionary MediaStreamTrackProcessorInit {
  required MediaStreamTrack track;
  [EnforceRange] unsigned short maxBufferSize;
};

[Exposed=DedicatedWorker]
interface VideoTrackGenerator {
  constructor();
  readonly attribute WritableStream writable;
  attribute boolean muted;
  readonly attribute MediaStreamTrack track;
};