Skip to content

Commit 6999eb5

Browse files
authored
Merge pull request w3c#17 from steveanton/execution
Add detailed design discussion for execution environments
2 parents f8a93b1 + d01f8a8 commit 6999eb5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

explainer.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ muxer.readable.pipeInto(output.writable);
302302

303303
## Detailed design discussion
304304

305+
### Execution environment
306+
307+
Encoder and decoder objects can be instantiated on the main thread and on dedicated workers. Additionally, the ReadableStream and WritableStream components of each object can be transferred to other contexts (utilizing the [transferable stream][transferable-streams] infrastructure).
308+
309+
Encode and decode operations can be very computationally expensive. As such, user agents must perform the operations asynchronously with the JavaScript which initiates the operation. The execution environment of the codec implementation is defined by the user agent. Some possibilities include: sequentially or in parallel on an internal thread pool, or on a hardware acceleration unit (e.g., a GPU).
310+
311+
By building on the Streams infrastructure, WebCodecs allows the user agent to optimize the transfer of chunks between JavaScript and internal execution environments. The user agent should take great care to efficiently handle expensive resources (e.g., video frame contents, GPU resource handles).
312+
313+
[transferable-streams]: https://github.com/whatwg/streams/blob/master/transferable-streams-explainer.md
314+
305315
### Codec configuration
306316

307317
Many codecs and encoder/decoder implementations are highly configurable. WebCodecs intends to support most of the configuration options available in codecs today to efficiently allow for advanced use cases.

0 commit comments

Comments
 (0)