Implement basic VideoDecoder on Linux
Categories
(Core :: Audio/Video: Web Codecs, task, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox116 | --- | fixed |
People
(Reporter: chunmin, Assigned: chunmin)
References
(Blocks 1 open bug)
Details
Attachments
(28 external files, 6 obsolete files)
This bug is a sub-task for bug 1749045. The task is to implement the basic VideoDecoder operations. The goal is to create an VideoDecoder that can pass the following wpts
- videoDecoder-codec-specific.https.any.js
- video-decoder.https.any.js
- video-decoder.crossOriginIsolated.https.any.js
On Linux platforms
| Assignee | ||
Comment 1•3 years ago
|
||
| Assignee | ||
Comment 2•3 years ago
|
||
Depends on D155894
| Assignee | ||
Comment 3•3 years ago
|
||
Depends on D155892
| Assignee | ||
Comment 4•3 years ago
|
||
| Assignee | ||
Comment 5•3 years ago
|
||
| Assignee | ||
Comment 6•3 years ago
|
||
| Assignee | ||
Comment 7•3 years ago
|
||
| Assignee | ||
Comment 8•3 years ago
|
||
| Assignee | ||
Comment 9•3 years ago
|
||
| Assignee | ||
Comment 10•3 years ago
|
||
| Assignee | ||
Comment 11•3 years ago
|
||
| Assignee | ||
Comment 12•3 years ago
|
||
| Assignee | ||
Comment 13•3 years ago
|
||
| Assignee | ||
Comment 14•3 years ago
|
||
| Assignee | ||
Comment 15•3 years ago
|
||
| Assignee | ||
Comment 16•3 years ago
|
||
| Assignee | ||
Comment 17•3 years ago
|
||
Depends on D171518
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 18•3 years ago
|
||
Depends on D171518
Updated•3 years ago
|
| Assignee | ||
Comment 19•3 years ago
|
||
let lastDequeueSize = Infinity;
decoder.ondequeue = () => {
assert_greater_than(lastDequeueSize, 0, "Dequeue event after queue empty");
assert_greater_than(lastDequeueSize, decoder.decodeQueueSize,
"Dequeue event without decreased queue size");
lastDequeueSize = decoder.decodeQueueSize;
};
The above checkes doesn't really work since the VideoDecoder's
codec-work-queue runs in parallel with the VideoDecoder interface. The
dequeue events can arrive after the last dequeue size has been 0 if the
work queue decodes multiple samples while VideoDecoder is processing
just one dequeue event. Besides, decodeQueueSize can change between
the two decoder.decodeQueueSize calls since it can be mutated on both
VideoDecoder's owner thread and the codec-work-queue thread. As a
result, these two decodeQueueSize can be different, and the
lastDequeueSize is not guaranteed to be decreased one at a time per
event, even if the internal decodeQueueSize is decreased one at a time
(on codec-work-queue thread). The value can be decreased more than one
at a time.
The following example demonstrates one case when those checks can fail.
Suppose VideoDecoder D runs on thread T (main or worker) and
codec-work-queue runs on thread Q. In the test, by the time
VideoDecoder is configured successfully and decode request are sent,
the codec-work-queue is ready to decode the pending samples. Below
illustrates why the wpt checks in the begining don't work
Q) The underlying codec is configured, ready to decode sample #1.
Schedule a dequeue event. The current queue size is 9.
T) Get a dequeue event #1. Now D.decodeQueueSize is 9.
Q) Decode sample #1 succeeded, ready to decode sample #2. Schedule a
dequeue event. The current queue size is 8.
T) D.decode() for sample #1 succeeded. Get VideoFrame #1.
T) Get a dequeue event #2. Now D.decodeQueueSize is 8.
Q) Decode sample #2 succeeded, ready to decode sample #3. Schedule a
dequeue event. The current queue size is 7.
T) D.decode() for sample #2 succeeded. Get VideoFrame #2.
Q) Decode sample #3 succeeded, ready to decode sample #4. Schedule a
dequeue event. The current queue size is 6.
Q) Decode sample #4 succeeded, ready to decode sample #5. Schedule a
dequeue event. The current queue size is 5.
T) Get a dequeue event #3. Now D.decodeQueueSize is 5.
T) D.decode() for sample #3 succeeded. Get VideoFrame #3.
T) Get a dequeue event #4. Now D.decodeQueueSize is 5.
=> "Dequeue event without decreased queue size" fails here
Q) Decode sample #5 succeeded, ready to decode sample #6. Schedule a
dequeue event. The current queue size is 4.
Q) Decode sample #6 succeeded, ready to decode sample #7. Schedule a
dequeue event. The current queue size is 3.
Q) Decode sample #7 succeeded, ready to decode sample #8. Schedule a
dequeue event. The current queue size is 2.
T) D.decode() for sample #4 succeeded. Get VideoFrame #4.
T) Get a dequeue event #5. Now D.decodeQueueSize is 2.
T) D.decode() for sample #5 succeeded. Get VideoFrame #5.
T) Get a dequeue event #6. Now D.decodeQueueSize is 2.
=> "Dequeue event without decreased queue size" fails again here
Q) Decode sample #8 succeeded, ready to decode sample #9. Schedule a
dequeue event. The current queue size is 1.
T) D.decode() for sample #6 succeeded. Get VideoFrame #6.
Q) Decode sample #9 succeeded, ready to decode sample #10. Schedule a
dequeue event. The current queue size is 0.
T) Get a dequeue event #7. Now D.decodeQueueSize is 0.
T) D.decode() for sample #7 succeeded. Get VideoFrame #7.
T) Get a dequeue event #8. D.decodeQueueSize is still 0.
=> "Dequeue event after queue empty" fails here
=> "Dequeue event without decreased queue size" fails here as well
In brief, what VideoDecoder can guarantee are the order of dequeue
event, decode() result, and the flush() result:
- For sample #N, its dequeue event arrives before it's decode()
callback - The results/callbacks of decode() and flush() are arrived in FIFO
order
There is no guarantee that decodeQueueSize read on the VideoDecoder's
owner thread only decrease one per dequeue event. If the
codec-work-queue decodes sample #1, #2, ... , #K while the dequeue event
for sample #1 is being dispatched to or handled on the VideoDecoder's
owner thread, the last-dequeueQueueSize can drop more than one compared
to it's previous value, and for the same reason, the dequeue event can
arrive even if the last-dequeueQueueSize has been set to 0.
Depends on D177212
| Assignee | ||
Comment 20•3 years ago
|
||
The WPT assumes the error callback invoked via the decode() failure will
arrive before flush()'s promise, but it's not guaranteed. The example
below demonstrates why this assumption isn't held.
Suppose VideoDecoder D runs on thread T (main or worker) and
codec-work-queue runs on thread Q. In the test, by the time
VideoDecoder is configured successfully and decode request are sent,
the codec-work-queue is ready to decode the pending samples. Below
illustrates that error callback can arrive after flush()'s promise.
Q) The underlying codec is configured, ready to decode sample #1.
Q) Decode sample #1 succeeded, ready to decode sample #2.
T) D.decode() for sample #1 succeeded. Get VideoFrame #1.
Q) Decode sample #1 failed, ready to flush the decoder.
T) D.decode() for sample #2 failed. Close D via close() with an
EncodingError. The close queues a task to invoke the error
callback.
Q) Flush has been done.
T) D.flush() has done (but D has been closed) and its promise get
rejected
=> error callback hasn't arrive yet!
T) The error callback scheduled by close above is called
Depends on D179514
Updated•3 years ago
|
| Assignee | ||
Comment 21•3 years ago
|
||
BitReader::ReadBits will call a NS_ASSERTION when the request is
unreasonable. However, in WebCodecs' VedioDecoder wpt, one test will
intentionally decode a corrupted sample and it makes the av1 decoder to
reach that assertion and cause a wpt failure. Since that assertion
doesn't really do any meaningful work, downgrade it to NS_WARNING
to make wpt work seems fine.
Depends on D179515
| Assignee | ||
Comment 22•3 years ago
|
||
Depends on D171518
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 23•3 years ago
|
||
If decoding results in an error, queue a task to run the Close
VideoDecoder algorithm with EncodingError and return
By the spec, in step 4-2 when running a control message for decode, the
flush queued after decode should be rejected with a EncodingError, via
Close algorithm, instead of AbortError.
Depends on D179583
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 24•3 years ago
|
||
This patch addes work-arounds to using MOZ_CAN_RUN_SCRIPT function in
nsIEventTarget::Dispatch and runnables. The MOZ_CAN_RUN_SCRIPT functions
should be executed onlt within another MOZ_CAN_RUN_SCRIPT function.
However, Dispatch functions have no MOZ_CAN_RUN_SCRIPT marks so this
patch addes work-arounds to avoid those kind of warnings.
Depends on D179515
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
Comment 25•3 years ago
|
||
Comment on attachment 9331698 [details]
Bug 1831451 - Add a blank EncodedVideoChunk interface
Revision D155892 was moved to bug 1838958. Setting attachment 9331698 [details] to obsolete.
Comment 26•3 years ago
|
||
Comment on attachment 9331699 [details]
Bug 1831451 - Implement EncodedVideoChunk
Revision D158238 was moved to bug 1838958. Setting attachment 9331699 [details] to obsolete.
Comment 27•3 years ago
|
||
Comment on attachment 9331701 [details]
Bug 1831451 - Add NS_WARN_IF to unlikely condition
Revision D158815 was moved to bug 1838958. Setting attachment 9331701 [details] to obsolete.
| Assignee | ||
Comment 28•3 years ago
|
||
Depends on D180982
| Assignee | ||
Comment 29•3 years ago
|
||
Depends on D181327
| Assignee | ||
Comment 30•3 years ago
|
||
Depends on D166402
| Assignee | ||
Comment 31•3 years ago
|
||
DecoderAgent is a class operating MediaDataDecoder. It combines multiple
MediaDataDecoder APIs into one to serve WebCodecs' needs.
Depends on D181818
| Assignee | ||
Comment 32•3 years ago
|
||
Depends on D161356
| Assignee | ||
Comment 33•3 years ago
|
||
Depends on D171809
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 34•3 years ago
|
||
H264-annexb doesn't work on non-linux for now. This will be sovled in
Bug 1840192 later.
Depends on D179515
Updated•3 years ago
|
| Assignee | ||
Comment 35•3 years ago
|
||
This patch replaces the using ControlMessage = Variant<...> by a
class ControlMessage, which wraps the common interfaces and variables
of the classes within the above Variant into a class.
Depends on D179515
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 36•3 years ago
|
||
To batter tracking the ControlMessage logs, ConfigureMessage should
generate a unique Id for itself and its following DecodeMessages and
FlushMessages. Besides, that unique id can be assigned to DecoderAgent
as well. As a result, it's easier to know what ConfigureMessage and
DecoderAgent the DecodeMessage/FlushMessage belongs.
This patch moves the id generation from DecoderAgent to ConfigureMessage
so the id can be used for both of DecoderAgent and ConfigureMessage.
Depends on D182124
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 37•3 years ago
|
||
Comment 39•3 years ago
|
||
Backed out for causing hazard failures on VideoDecoder.cpp
Failure log: https://treeherder.mozilla.org/logviewer?job_id=421052163&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/b0bf1e68a80c2a34bfb859b939005f93b9d39b5d
Comment 41•3 years ago
|
||
| Assignee | ||
Comment 42•3 years ago
•
|
||
I've added additional fixes on top of D182476 and make it pass the hazard test:
https://treeherder.mozilla.org/jobs?repo=try&revision=3186420fde92bb56c5c288855de3e84f425c365b&selectedTaskRun=IBj231ftTZK5_tL-Xvk-rQ.0
I am going to merge my fixes into D182476 so we can land it.
Comment 43•3 years ago
|
||
| Assignee | ||
Comment 44•3 years ago
•
|
||
Just found a unused-variable in the D182476. Here is the simple fix: https://phabricator.services.mozilla.com/D182533
It will be done with other issues in bug 1841193
Comment 45•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/77b0f5226ed8
https://hg.mozilla.org/mozilla-central/rev/02cb31bfdc0f
https://hg.mozilla.org/mozilla-central/rev/23bc44bf238c
https://hg.mozilla.org/mozilla-central/rev/58a0e543998b
https://hg.mozilla.org/mozilla-central/rev/e06fd5d60970
https://hg.mozilla.org/mozilla-central/rev/981e50f618d0
https://hg.mozilla.org/mozilla-central/rev/d62002584cf3
https://hg.mozilla.org/mozilla-central/rev/13f8ed81dca8
https://hg.mozilla.org/mozilla-central/rev/aea093a94985
https://hg.mozilla.org/mozilla-central/rev/43451f9834e7
https://hg.mozilla.org/mozilla-central/rev/226dda36eb9e
https://hg.mozilla.org/mozilla-central/rev/a86ecdaa1716
https://hg.mozilla.org/mozilla-central/rev/57df271c6d6c
https://hg.mozilla.org/mozilla-central/rev/290fcbe92f0a
https://hg.mozilla.org/mozilla-central/rev/0899b9a2539e
https://hg.mozilla.org/mozilla-central/rev/b49ae6bc356a
https://hg.mozilla.org/mozilla-central/rev/1ec020b42625
https://hg.mozilla.org/mozilla-central/rev/bdfa5574beda
https://hg.mozilla.org/mozilla-central/rev/20228a5c6504
https://hg.mozilla.org/mozilla-central/rev/ad5a8d4e40e6
https://hg.mozilla.org/mozilla-central/rev/30eaff96a933
https://hg.mozilla.org/mozilla-central/rev/049d2679df84
https://hg.mozilla.org/mozilla-central/rev/b3c2b04d4a36
https://hg.mozilla.org/mozilla-central/rev/8fe486442687
https://hg.mozilla.org/mozilla-central/rev/ff0876ea84c9
https://hg.mozilla.org/mozilla-central/rev/0ac162e771bb
https://hg.mozilla.org/mozilla-central/rev/7dd351fce5ad
https://hg.mozilla.org/mozilla-central/rev/6c61c412fe0b
| Assignee | ||
Updated•3 years ago
|
Description
•