diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/webcodecs/video_decoder.idl')
-rw-r--r-- | chromium/third_party/blink/renderer/modules/webcodecs/video_decoder.idl | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/modules/webcodecs/video_decoder.idl b/chromium/third_party/blink/renderer/modules/webcodecs/video_decoder.idl new file mode 100644 index 00000000000..8d930506f5e --- /dev/null +++ b/chromium/third_party/blink/renderer/modules/webcodecs/video_decoder.idl @@ -0,0 +1,87 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://github.com/WICG/web-codecs + +// A VideoDecoder processes a queue of configure, decode, and flush requests. +// Requests are taken from the queue sequentially but may be processed +// concurrently. +// +// TODO(sandersd): Specify a tune() implementation for changing decoder +// parameters (separate from stream parameters). This is more important for +// encoders. +[RuntimeEnabled=WebCodecs] +interface VideoDecoder { + // |init| includes an |output| callback for emitting VideoFrames and an + // |error| callback for emitting decode errors. + // + // When in an error state, methods other than reset() will fail. + // + // TODO(sandersd): Consider adding a state or last error attribute. + // TODO(sandersd): Consider aborting pending decodes on error, rather than + // waiting for reset(). + [CallWith=ScriptState, RaisesException] constructor(VideoDecoderInit init); + + // The number of queued decode requests. This does not include requests that + // have been taken for processing. + // + // Applications can minimize underflow by enqueueing decode requests until + // |decodeQueueSize| is greater than a constant. + readonly attribute long decodeQueueSize; + + // The number of decode requests currently being processed. + // + // Applications can minimize resource consumption and decode latency by + // enqueueing decode requests only when |decodeQueueSize| and + // |decodeProcessingCount| are small. + // + // TODO(sandersd): Consider counting queued decode requests as well. This + // could be simpler for apps. + readonly attribute long decodeProcessingCount; + + // Enqueue a request to set or change the stream configuration. + // + // The next enqueued decode request must be for a keyframe. + // + // Resolved after emitting output for all earlier decode requests. + // + // TODO(sandersd): Test that resolution (a microtask) interleaves between + // outputs callback calls in all cases. + // TODO(sandersd): Move the keyframe rule into the bytestream registry. + [RaisesException] Promise<void> configure(EncodedVideoConfig config); + + // Enqueue a request to decode an input chunk. + // + // You must call configure() before calling enqueue() for the first time. + // + // Resolved after decoding of the input chunk has started (that is, after + // decreasing |decodeQueueSize|). + // + // TODO(sandersd): Change to a dictionary type. + // TODO(sandersd): Should we guarantee that resolution occurs in order? + // TODO(sandersd): Add status to result. + // TODO(sandersd): Buffer return. + [RaisesException] Promise<void> decode(EncodedVideoChunk chunk); + + // Enqueue a request to finish decoding queued input chunks. + // + // The next enqueued input chunk must be a keyframe. + // + // Resolved after emitting output for all earlier decode requests. + // + // TODO(sandersd): Consider relaxing the keyframe requirement. + [RaisesException] Promise<void> flush(); + + // Discard all pending work. + // + // Output for earlier decode requests will not be emitted, even if processing + // has already started. + // + // The next enqueued input chunk must be a keyframe. + // + // Resolved after all earlier enqueue() promises have been resolved. + // + // TODO(sandersd): Require configure() after reset()? + [RaisesException] Promise<void> reset(); +}; |