Commit graph

88 commits

Author SHA1 Message Date
Chun-Min Chang
b1051f95c9 Bug 1840965 - Move Decode to template r=padenot
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
2023-10-11 16:41:50 +00:00
Chun-Min Chang
331ece38c4 Bug 1840965 - Move Configure to template r=padenot
Depends on D188902

Differential Revision: https://phabricator.services.mozilla.com/D188903
2023-10-11 16:41:50 +00:00
Chun-Min Chang
ae1efbcdae Bug 1840965 - Log errors in Validate r=padenot
Depends on D188901

Differential Revision: https://phabricator.services.mozilla.com/D188902
2023-10-11 16:41:49 +00:00
Chun-Min Chang
39c1c44603 Bug 1840965 - Move ParseCodecString to WebCodecsUtils r=padenot
Depends on D188900

Differential Revision: https://phabricator.services.mozilla.com/D188901
2023-10-11 16:41:49 +00:00
Chun-Min Chang
5bb7975540 Bug 1840965 - Move Reset and Close to template r=padenot
Depends on D188899

Differential Revision: https://phabricator.services.mozilla.com/D188900
2023-10-11 16:41:49 +00:00
Chun-Min Chang
df2daa5e72 Bug 1840965 - Move State() and DecodeQueueSize() to template r=padenot
Depends on D188663

Differential Revision: https://phabricator.services.mozilla.com/D188664
2023-10-11 16:41:48 +00:00
Chun-Min Chang
a89754a092 Bug 1840965 - Add input-to-MediaRawData conversion to template r=padenot
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
2023-10-11 16:41:47 +00:00
Chun-Min Chang
52fc080c64 Bug 1840965 - Create a decoder template r=padenot
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
2023-10-11 16:41:47 +00:00
Chun-Min Chang
f0405f71fe Bug 1840965 - Rework CanDecode and its friends r=padenot
Depends on D188537

Differential Revision: https://phabricator.services.mozilla.com/D189012
2023-10-11 16:41:47 +00:00
Chun-Min Chang
df4fca62c7 Bug 1840965 - Forward declarations for helper classes r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188537
2023-10-11 16:41:46 +00:00
Butkovits Atila
b642419c68 Backed out 14 changesets (bug 1840965) for causing bustages at DecoderTemplate.cpp. CLOSED TREE
Backed out changeset 85effc98ea3f (bug 1840965)
Backed out changeset b9d860c9e3db (bug 1840965)
Backed out changeset 1256f6ae660b (bug 1840965)
Backed out changeset de01c0a052af (bug 1840965)
Backed out changeset 63b4c6f83bc9 (bug 1840965)
Backed out changeset fa4ef4d675e3 (bug 1840965)
Backed out changeset e313ff51eaa7 (bug 1840965)
Backed out changeset 5e3e9670fc35 (bug 1840965)
Backed out changeset 2689f9277a89 (bug 1840965)
Backed out changeset 2b449894a1fc (bug 1840965)
Backed out changeset 44adca2aa7b7 (bug 1840965)
Backed out changeset 4c1d4aba133c (bug 1840965)
Backed out changeset 5a6431259f5a (bug 1840965)
Backed out changeset d93847b9a7e7 (bug 1840965)
2023-10-02 19:32:20 +03:00
Chun-Min Chang
17a6baba0e Bug 1840965 - Move Flush to template r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D189016
2023-10-02 15:54:01 +00:00
Chun-Min Chang
6c5416a4a2 Bug 1840965 - Move Decode to template r=padenot
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
2023-10-02 15:54:00 +00:00
Chun-Min Chang
f75a9dac7e Bug 1840965 - Move Configure to template r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188903
2023-10-02 15:54:00 +00:00
Chun-Min Chang
ea83ca0dc9 Bug 1840965 - Log errors in Validate r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188902
2023-10-02 15:53:59 +00:00
Chun-Min Chang
3148740219 Bug 1840965 - Move ParseCodecString to WebCodecsUtils r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188901
2023-10-02 15:53:59 +00:00
Chun-Min Chang
0d84dbfbbf Bug 1840965 - Move Reset and Close to template r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188900
2023-10-02 15:53:59 +00:00
Chun-Min Chang
c9ce442a83 Bug 1840965 - Move State() and DecodeQueueSize() to template r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188664
2023-10-02 15:53:57 +00:00
Chun-Min Chang
6fac7ea72d Bug 1840965 - Add input-to-MediaRawData conversion to template r=padenot
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
2023-10-02 15:53:57 +00:00
Chun-Min Chang
1aff6cf248 Bug 1840965 - Create a decoder template r=padenot
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
2023-10-02 15:53:57 +00:00
Chun-Min Chang
4757d219b2 Bug 1840965 - Rework CanDecode and its friends r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D189012
2023-10-02 15:53:56 +00:00
Chun-Min Chang
89d917cb9d Bug 1840965 - Forward declarations for helper classes r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D188537
2023-10-02 15:53:56 +00:00
Jan Varga
c458754592 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Andrew Osmond
100e56e28e Bug 1854431 - Extract surface format from GPUVideoImage for VideoFrame. r=media-playback-reviewers,chunmin
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
2023-09-21 23:45:16 +00:00
Peter Van der Beken
cdd05c282d Bug 1690111 - Use new TypedArray APIs for appending data to a container. r=farre,extension-reviewers,media-playback-reviewers,kmag,alwu,padenot
Depends on D152494

Differential Revision: https://phabricator.services.mozilla.com/D152495
2023-09-20 09:42:01 +00:00
Cosmin Sabou
680b4364c7 Backed out 13 changesets (bug 1690111) for causing fetch related crashes.
Backed out changeset 5f2c25d194ad (bug 1690111)
Backed out changeset 76c408bcd053 (bug 1690111)
Backed out changeset 6d0649fdafff (bug 1690111)
Backed out changeset c1330b5e8c43 (bug 1690111)
Backed out changeset 5fa36d8fd2a5 (bug 1690111)
Backed out changeset daf7d747853a (bug 1690111)
Backed out changeset f70e09a7f5c6 (bug 1690111)
Backed out changeset 40c6d6eed7f8 (bug 1690111)
Backed out changeset 692f2a759573 (bug 1690111)
Backed out changeset 7140866dd9f6 (bug 1690111)
Backed out changeset 2865fe682139 (bug 1690111)
Backed out changeset 9dcd2416f8a5 (bug 1690111)
Backed out changeset 9c411bf84079 (bug 1690111)
2023-09-11 17:55:24 +03:00
Peter Van der Beken
39cc003472 Bug 1690111 - Use new TypedArray APIs for appending data to a container. r=farre,extension-reviewers,media-playback-reviewers,kmag,alwu,padenot
Depends on D152494

Differential Revision: https://phabricator.services.mozilla.com/D152495
2023-09-11 12:52:20 +00:00
Chun-Min Chang
047f05221d Bug 1848193 - Enable WebCodecs on Windows r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D186040
2023-09-06 16:15:31 +00:00
Chun-Min Chang
db3a0dbaee Bug 1848193 - Add debug logs for close r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D185971
2023-09-06 16:15:30 +00:00
Paul Adenot
001148d1c8 Bug 1849271 - Flip test when checking for the presence of optional colorspace members on a VideoDecoderConfig. r=media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D186530
2023-08-22 14:33:21 +00:00
Chun-Min Chang
690ccbbde6 Bug 1846796 - Enable on WebCodecs on Mac OS r=padenot
Depends on D185194

Differential Revision: https://phabricator.services.mozilla.com/D185195
2023-08-11 17:22:39 +00:00
Chun-Min Chang
098296d2fc Bug 1846796 - Set extra data only when description is given r=padenot
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
2023-08-11 17:22:39 +00:00
Chun-Min Chang
e1febcd180 Bug 1846102 - Make WPTs spec-compliant r=padenot
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
2023-08-11 00:06:30 +00:00
Chun-Min Chang
60f3990e42 Bug 1846102 - Distinguish "supported" from "valid" codec r=padenot
By the latest spec [1], the "invalid" is more like "empty" rather than
"supported". The "supported" codec must be a "valid" codec, while the
"valid" codec may be "unsupported".

[1] https://github.com/w3c/webcodecs/pull/707

Differential Revision: https://phabricator.services.mozilla.com/D184873
2023-08-11 00:06:30 +00:00
Chun-Min Chang
9cb61cd162 Bug 1846102 - Pack GuessMIMETypes parameters into struct r=padenot
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
2023-08-11 00:06:30 +00:00
Chun-Min Chang
544c718a56 Bug 1846102 - Add a shortcut to get pointer from Optional r=padenot
This patch adds a function to get the pointer pointing to the value in
Optional if any.

Differential Revision: https://phabricator.services.mozilla.com/D184871
2023-08-11 00:06:29 +00:00
Chun-Min Chang
101c720bb3 Bug 1846102 - Trim leading and trailing spaces in codec string r=padenot
By the latest spec about validating VideoDecoderConfig, the codec string
can have leading and trailing spaces, so we should trim them to get the
real codec string.

[1] https://w3c.github.io/webcodecs/#valid-videodecoderconfig

Differential Revision: https://phabricator.services.mozilla.com/D184870
2023-08-11 00:06:29 +00:00
Chun-Min Chang
7fa46b8f96 Bug 1842116 - Replace ChunkData by EncodedVideoChunkData r=padenot
`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
2023-07-21 19:03:21 +00:00
Chun-Min Chang
23eac82faf Bug 1844206 - Validate H265 codec string in VideoDecoder r=padenot
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
2023-07-20 18:24:53 +00:00
Chun-Min Chang
c4558c04f0 Bug 1844206 - Add error logs in VideoDecoderConfigInternal::Create r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D183927
2023-07-20 18:24:52 +00:00
Chun-Min Chang
c4051096ce Bug 1844206 - Add error logs in Configure & IsConfigSupported r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D183926
2023-07-20 18:24:51 +00:00
Chun-Min Chang
9bf85845a4 Bug 1844206 - Reject IsConfigSupported with explicit error message r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D183925
2023-07-20 18:24:51 +00:00
Chun-Min Chang
3e6fb612f1 Bug 1841903 - Apply const to ChunkData members if possible r=padenot
Depends on D182837

Differential Revision: https://phabricator.services.mozilla.com/D182838
2023-07-07 18:07:52 +00:00
Chun-Min Chang
55a6465759 Bug 1841903 - Use utils in ChunkData ctor r=padenot
Depends on D182835

Differential Revision: https://phabricator.services.mozilla.com/D182837
2023-07-07 18:07:51 +00:00
Chun-Min Chang
a1ad227490 Bug 1841903 - Move Maybe-utils to WebCodecUtils r=padenot
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
2023-07-07 18:07:51 +00:00
Norisz Fay
d8587a69a7 Backed out 5 changesets (bug 1841903) for causing Video related build bustages
Backed out changeset 5cea29422288 (bug 1841903)
Backed out changeset 61f6eaaa51d6 (bug 1841903)
Backed out changeset 0027a9fd3c45 (bug 1841903)
Backed out changeset 1ce06e14e96b (bug 1841903)
Backed out changeset 33021233c2e9 (bug 1841903)
2023-07-07 05:54:01 +03:00
Chun-Min Chang
ccf19e2207 Bug 1841903 - Apply const to ChunkData members if possible r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D182838
2023-07-07 00:18:14 +00:00
Chun-Min Chang
75ee4afa3e Bug 1841903 - Use utils in ChunkData ctor r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D182837
2023-07-07 00:18:14 +00:00
Chun-Min Chang
3e485a4a56 Bug 1841903 - Move Maybe-utils to WebCodecUtils r=padenot
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
2023-07-07 00:18:13 +00:00
Chun-Min Chang
6813b4bd73 Bug 1841193 - Save unnecessary copy in IsConfigSupported r=padenot
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
2023-07-05 19:57:56 +00:00