Implement EncodeBatch
Categories
(Core :: Audio/Video, task, P5)
Tracking
()
People
(Reporter: chunmin, Assigned: chunmin)
References
(Blocks 2 open bugs)
Details
(Keywords: dev-doc-needed)
Attachments
(9 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
MediaDataEncoder should provide an EncodeBatch(nsTArray<RefPtr<MediaData>>&& aSamples) interface, mirroring the one in MediaDataDecoder, to allow users to encode all collected pending input samples in a single call.
This bug will implement this for WMFMediaDataEncoder first
| Assignee | ||
Comment 1•4 months ago
•
|
||
Unlike MediaDataDecoder, I propose signaling whether EncodeBatch is supported through the result of MediaDataEncoder's InitPromise, rather than adding a separate CanEncodeBatch() method.
For implementing CanEncodeBatch in RemoteMediaDataEncoderChild, there are two options:
- Always return
true, and internally manage pending inputs withinRemoteMediaDataEncoderChildif the underlying encoder does not supportEncodeBatch. - Query the
CanEncodeBatchcapability from the underlying encoder viaRemoteMediaDataEncoderParentto reflect the literal capability. However, this would require an asynchronous IPC round-trip, adding unnecessary complexity.
Since Encode() must be called only after Init(), and Init() is already asynchronous and responsible for checking the encoderโs capabilities, it is more straightforward to include a flag in the InitPromise result indicating whether EncodeBatch is supported. Besides, RemoteMediaDataEncoderChild is still able to support EncodeBatch this way, by managing pending inputs internally if needed.
| Assignee | ||
Comment 2•4 months ago
|
||
| Assignee | ||
Comment 3•3 months ago
|
||
| Assignee | ||
Comment 4•3 months ago
|
||
| Assignee | ||
Comment 5•3 months ago
|
||
| Assignee | ||
Comment 6•3 months ago
|
||
- Remove unused EncoderAgent::Dry
- Fix typo in EncoderAgent::Encode
- Rename EncoderAgent::State::Flushing to Draining
(NoFlushAPI inMediaDataEncoder) - Shorten helper's name from DryUntilDrain to Dry
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
| Assignee | ||
Comment 7•3 months ago
|
||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
| Assignee | ||
Comment 8•2 months ago
|
||
- Simplify utilities for Encode() and Drain()
- Fail the tests with the error received instead of silently fall on length comparison failure
| Assignee | ||
Comment 9•2 months ago
|
||
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
| Assignee | ||
Comment 10•2 months ago
|
||
This patch extends batch encoding support to additional encoders, inclduing
FFmpeg encoders, GMP encoder, Android encoder, and macOS encoders. The
implementations for GMP and macOS are not optimized for best real-time
performance, but their usage will be limited via a preference. A more complete
implementation will be addressed in Bug 1984936.
Updated•2 months ago
|
Updated•2 months ago
|
| Assignee | ||
Comment 11•2 months ago
|
||
The try build shows that it encounters a build issue in Bug 1985779
Comment 12•2 months ago
|
||
Comment 13•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b69b5e109e20
https://hg.mozilla.org/mozilla-central/rev/162a9c7f2d8c
https://hg.mozilla.org/mozilla-central/rev/ed01114ba3f0
https://hg.mozilla.org/mozilla-central/rev/da26055f237b
https://hg.mozilla.org/mozilla-central/rev/2f03e71f9c38
https://hg.mozilla.org/mozilla-central/rev/91d92a991a85
https://hg.mozilla.org/mozilla-central/rev/8797167998a3
https://hg.mozilla.org/mozilla-central/rev/11fcf466d916
https://hg.mozilla.org/mozilla-central/rev/8c12efc0cf12
https://hg.mozilla.org/mozilla-central/rev/a625072aae8c
Comment 14•2 months ago
|
||
:chunmin, could you consider nominating this for a release note? (Process info)
| Assignee | ||
Comment 15•2 months ago
|
||
:chunmin, could you consider nominating this for a release note? (Process info)
Not sure if this is important to regular users since it's more for website/front-end engineers, but I can add some notes describing what this bug was doing.
Release Note Request (optional, but appreciated)
[Why is this notable]:
This work enables batch submission for WebCodecs' encode requests, improving throughput and reducing encode submission latency (especially right after encoder initialization). It's pref-gated so testers can experiment and compare performance.
[Affects Firefox for Android]: No practical impact. On non-Windows platforms the batch size defaults to 1, so behavior is unchanged unless explicitly overridden.
[Suggested wording]:
WebCodecs now has a pref-gated batch-encoding path for VideoEncoder (Bug 1978232). On Windows, a large default batch size (controlled by dom.media.webcodecs.batch-encoding-size) improves encoding throughput and reduces encodes submission latency. Other platforms default to a batch size of 1, preserving current behavior. When media.use-remote-encoder.video is enabled, batching further reduces cross-process overhead for better performance.
[Links (documentation, blog post, etc)]: This page (bug 1978232)?
Comment 16•2 months ago
|
||
Not sure if this is important to regular users since it's more for website/front-end engineers
Thanks, we have a section in the release notes for website/front-end engineers. I'll will add it to that section, but I will slightly reword it that it's only on by default on Windows.
Will update here once that's done.
Comment 17•2 months ago
|
||
Added to the Fx144 nightly release notes, please allow 30 minutes for the site to update.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx144 release notes.
Updated•2 months ago
|
Comment 18•1 month ago
|
||
FF144 MDN work for this can be tracked in https://github.com/mdn/content/issues/41139
MDN mostly documents things that impact what front-end developers have to do to use an API.
To me this change looks to be "internal" - i.e. it makes WebCodecs more efficient, but it doesn't require any extra awareness from front end developers in order for them to benefit from it.
So I don't think there is any compatibility change or API interface change that needs to be documented.
Can you confirm?
If there is a compatibility or interface change for JavaScript developers, please outline what changes you would like to see in the documentation.
| Assignee | ||
Comment 19•1 month ago
|
||
You're right. This is more like an internal change. No compatibility or API interface change.
On Windows, this feature will be turned on automatically for H264 encoders when certain conditions are met. Users on other platforms can turn it for on for H264 encoders by setting the preference value (currently, non-H264 encoders are not allowed to use this feature).
Description
•