This patches renames the OutputVideoFrames to OutputDecodedData and add
a function to convert DecodedData to the output type defined by the
template inheritance.
Depends on D188903
Differential Revision: https://phabricator.services.mozilla.com/D189015
This patch moves the input-to-MediaRawData conversion from DecodeMessage
to a template function so that the template inheritance can implement
its own conversion function.
Depends on D188538
Differential Revision: https://phabricator.services.mozilla.com/D188663
This patch creates a C++ template that will be used as a base class of
WebCodecs' VideoDecoder and (future) AudioDecoder.
Currently, only the internal member variabls and functions are moved
into the template class. The common interfaces shared between the
VideoDecoder and the AudioDecoder will be moved to the template in the
following patches.
Note that some changes are made in this patch:
- Add a VideoDecoderTraits type to specify the types used in the decoder
template
- Reset(const nsresult& aResult) and Close(...) for internal usages are
renamed to ResetInternal in order to be distinguished from the
Reset(ErrorResult& aRv) in the VideoDecoder's public interface
- ControlMessage-related classes become nested classes since they have
member variables whose types depends on the template's typename
- DecodedDataToVideoFrame is generalized to a function named
DecodedDataToOutputType that convert the decoded data to a specific
type (e.g., VideoFrame for VideoDecoder)
- Rename CreateVideoInfo to CreateTrackInfo and move it to
VideoDecoderTraits so that the decoder template can get a TrackInfo
from the template inheritance
- Add a IsSupported method to VideoDecoderTraits so that the decoder
template can know what codec its template ingeritance supports
Depends on D189012
Differential Revision: https://phabricator.services.mozilla.com/D188538
This patches renames the OutputVideoFrames to OutputDecodedData and add
a function to convert DecodedData to the output type defined by the
template inheritance.
Differential Revision: https://phabricator.services.mozilla.com/D189015
This patch moves the input-to-MediaRawData conversion from DecodeMessage
to a template function so that the template inheritance can implement
its own conversion function.
Differential Revision: https://phabricator.services.mozilla.com/D188663
This patch creates a C++ template that will be used as a base class of
WebCodecs' VideoDecoder and (future) AudioDecoder.
Currently, only the internal member variabls and functions are moved
into the template class. The common interfaces shared between the
VideoDecoder and the AudioDecoder will be moved to the template in the
following patches.
Note that some changes are made in this patch:
- Add a VideoDecoderTraits type to specify the types used in the decoder
template
- Reset(const nsresult& aResult) and Close(...) for internal usages are
renamed to ResetInternal in order to be distinguished from the
Reset(ErrorResult& aRv) in the VideoDecoder's public interface
- ControlMessage-related classes become nested classes since they have
member variables whose types depends on the template's typename
- DecodedDataToVideoFrame is generalized to a function named
DecodedDataToOutputType that convert the decoded data to a specific
type (e.g., VideoFrame for VideoDecoder)
- Rename CreateVideoInfo to CreateTrackInfo and move it to
VideoDecoderTraits so that the decoder template can get a TrackInfo
from the template inheritance
- Add a IsSupported method to VideoDecoderTraits so that the decoder
template can know what codec its template ingeritance supports
Differential Revision: https://phabricator.services.mozilla.com/D188538
This patch allows us to extract a VideoPixelFormat for a VideoFrame when
backed by a GPUVideoImage. This in turn is used by SurfaceFromVideoFrame
for canvas drawing. With a concrete surface format, we can avoid
readbacks with WebGL in particular and dramatically improve performance
in existing demos.
Differential Revision: https://phabricator.services.mozilla.com/D188853
The extra data may be set to the default one with guessed values. We
should only set it when description data is provided.
Differential Revision: https://phabricator.services.mozilla.com/D185193
By step 3 of Running a control message to configure the decoder in
VideoDecoder's configure method [1], if the codec is unsupported, the
NotSupportedError will be delivered within the error callback via
Close-VideoDecoder algorithm, instead of being throwed directly when the
configure method is called.
[1] https://w3c.github.io/webcodecs/#dom-videodecoder-configure
Differential Revision: https://phabricator.services.mozilla.com/D185603
This patch addes a struct that holds the parameters needed for
GuessMIMETypes() and the struct members can be set automatically from
VideoDecoderConfig{Internal}.
Differential Revision: https://phabricator.services.mozilla.com/D184872
`EncodedVideoChunkData` holds the data of `EncodedVideoChunk`, just like
what `DecodeMessage::ChunkData` does. Therefore, we should replace
`ChunkData` by `EncodedVideoChunkData` to make the code simpler.
Differential Revision: https://phabricator.services.mozilla.com/D183603
This patches allows VideoDecoder to validate a H265 string. However,
since we don't support H265 in our decode pipeline yet, decoding the
h265 video will yeild an error.
The difference with the patch is that the IsConfigSupported now resolves
the promise with an codec-unsupported message instead of throwing a
TypeError saying this codec is invalid.
Differential Revision: https://phabricator.services.mozilla.com/D184053
The utils for conversion among Maybe, Nullable, and Optional added in
VideoDecoder should be moved to WebCodecsUtils so other files like
VideoFrame and EncodedVideoChunk can reuse those functions
Differential Revision: https://phabricator.services.mozilla.com/D182834
The utils for conversion among Maybe, Nullable, and Optional added in
VideoDecoder should be moved to WebCodecsUtils so other files like
VideoFrame and EncodedVideoChunk can reuse those functions
Differential Revision: https://phabricator.services.mozilla.com/D182834
This patch reworks CanDecode(). By making it accept not only
VideoDecoderConfigInternal but also VideoDecoderConfig as its argument,
the description data copied by converting VideoDecoderConfig to
VideoDecoderConfigInternal when checking the decodable information for
the given VideoDecoderConfig can be saved.
Differential Revision: https://phabricator.services.mozilla.com/D182591