Optimize latency of getting encoded result in AppleVTEncoder
Categories
(Core :: Audio/Video, enhancement, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox134 | --- | fixed |
People
(Reporter: chunmin, Assigned: chunmin)
References
(Blocks 1 open bug)
Details
Attachments
(11 files, 8 obsolete 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 | |
|
7.59 KB,
text/html
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently, the AppleVTEncoder's encoded result will delay at least one encoding iteration since the encoded output is yielded when Encode is called, not when ProcessOutput is executed.
In some cases (e.g., Zoom's web conferencing), getting the encoded result as soon as possible is critical. For now, the sample encoded in the Nth round will be dispatched by the (N+1) th round's output callback (That is, users need to call Encode again to get the previous Encode() results). Some real-time usage requires getting the encoded result ASAP (not in the next encoding iteration). Additionally, doing this aligns with the encoding behaviors in other codecs like VPX and AV1.
| Assignee | ||
Comment 1•1 year ago
•
|
||
This behavior can be tested by:
- Select a codec type (for H264, it requires to select AVC or ANNEXB as well)
- Check the Wait per frame option
- Open the console to watch the encoder outputs
Expected result: For all codecs, we can get one output data after one encode call
Actual result: For H264, no output is yielded after the first encode (other codecs work as expected)
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 2•1 year ago
|
||
| Assignee | ||
Comment 3•1 year ago
|
||
Depends on D222554
| Assignee | ||
Comment 4•1 year ago
|
||
Depends on D222555
| Assignee | ||
Comment 5•1 year ago
|
||
Depends on D222556
| Assignee | ||
Comment 6•1 year ago
|
||
Depends on D222557
| Assignee | ||
Comment 7•1 year ago
|
||
Depends on D222558
| Assignee | ||
Comment 8•1 year ago
|
||
Depends on D222559
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 9•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 10•1 year ago
|
||
Comment 11•1 year ago
|
||
Comment on attachment 9426036 [details]
WIP: Bug 1919384 - Remove empty comment
Revision D222883 was moved to bug 1920740. Setting attachment 9426036 [details] to obsolete.
Comment 12•1 year ago
|
||
Comment on attachment 9425428 [details]
WIP: Bug 1919384 - Remove an unused function
Revision D222555 was moved to bug 1920740. Setting attachment 9425428 [details] to obsolete.
Comment 13•1 year ago
|
||
Comment on attachment 9425427 [details]
WIP: Bug 1919384 - Add debugging logs
Revision D222554 was moved to bug 1920740. Setting attachment 9425427 [details] to obsolete.
Comment 14•1 year ago
|
||
Comment on attachment 9425429 [details]
WIP: Bug 1919384 - Correct SetFrameRate setting
Revision D222556 was moved to bug 1920740. Setting attachment 9425429 [details] to obsolete.
Comment 15•1 year ago
|
||
Comment on attachment 9425433 [details]
WIP: Bug 1919384 - Simplify realtime setting
Revision D222560 was moved to bug 1920740. Setting attachment 9425433 [details] to obsolete.
| Assignee | ||
Comment 16•1 year ago
|
||
Depends on D222558
Updated•1 year ago
|
Comment 17•1 year ago
|
||
Comment on attachment 9425430 [details]
WIP: Bug 1919384 - Release CFNumberRef for SVC setting automatically
Revision D222557 was moved to bug 1920740. Setting attachment 9425430 [details] to obsolete.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 18•1 year ago
|
||
| Assignee | ||
Comment 19•1 year ago
|
||
| Assignee | ||
Comment 20•1 year ago
|
||
Depends on D224052
| Assignee | ||
Comment 21•1 year ago
|
||
Previously, the AppleVTEncoder did not adequately handle situations
where encoding errors occured, frames were dropped, or the encoder
produced empty outputs. In such cases, the output processing callback
was not invoked. This issue is particularly problematic in real-time
encoding modification introduced in the prior patch, where the encode
promse is managed within the output processing callback, causing the
encode promise to remain pending indefinitely.
This patch introduces an enum that encompasses the following cases:
encode error, frame dropped, empty output, and success. When the system
callback is invoked, the encode result is labeled with one of these enum
valus. This result is then passed to the output processing callback,
allowing it to appropriately resolve or reject the encode promise based
on the specific usage.
By explicitly handling these scenarios, the encoder ensures that encode
promises are properly resolved or rejected in all the cases. This
improvement prevent promises from remaining unresolved and avoiding
potential application hangs.
Depends on D222559
| Assignee | ||
Comment 22•1 year ago
|
||
| Assignee | ||
Comment 23•1 year ago
|
||
Depends on D224054
| Assignee | ||
Comment 24•1 year ago
|
||
Depends on D224054
| Assignee | ||
Comment 25•1 year ago
|
||
This patch introduces 4K image encoding tests to evaluate the encoder's
behavior, specifically frame dropping, under different scenarios. By
incorporating 4K images into our test suite, we can thoroughly assess
how the encoder handles frame dropping policies in both Realtime and
Record usages.
In the Realtime usage scenario, it allows frames to be dropped if
necessary, preventing delays when the encoder cannot keep up with the
desired frame rate. In contrast, the Record usage scenario demands
that all frames be preserved to maintain the highest possible quality.
By adding these 4K tests, we can verify that the encoder correctly
handles frame dropping policies in each usage mode. In addition, it's
easier to assess the performance by adding some timestamps if needed.
Depends on D224436
Comment 26•1 year ago
|
||
Comment 27•1 year ago
|
||
Backed out for causing failures at GeckoProfiler.FeatureCombinations.
Backout link: https://hg.mozilla.org/integration/autoland/rev/979ca5fd251926fef0d911fe33e79a5f0ea4e9d8
Push with failures: https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception%2Cretry%2Cusercancel&revision=c8826ab7eda8418f81227ddf87eff2a8f6537a84
Failure log: https://treeherder.mozilla.org/logviewer?job_id=481016327&repo=autoland&lineNumber=39564
| Assignee | ||
Comment 28•1 year ago
•
|
||
(In reply to Atila Butkovits from comment #27)
Backed out for causing failures at GeckoProfiler.FeatureCombinations.
Backout link: https://hg.mozilla.org/integration/autoland/rev/979ca5fd251926fef0d911fe33e79a5f0ea4e9d8
Push with failures: https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception%2Cretry%2Cusercancel&revision=c8826ab7eda8418f81227ddf87eff2a8f6537a84
Failure log: https://treeherder.mozilla.org/logviewer?job_id=481016327&repo=autoland&lineNumber=39564
This is weird. Those patches are unrelated to GeckoProfiler. Besides, most of the patches are Mac only, and GeckoProfiler.FeatureCombinations only fails on Windows 11 x86 22H2 WebRender opt.
| Assignee | ||
Comment 29•1 year ago
|
||
From my test, applying D224436 on top of the mc has a high chance of making GeckoProfiler.AllThreads fail: https://treeherder.mozilla.org/jobs?repo=try&selectedTaskRun=bgBVvCGUQx2x2qqa0NubPg.0&revision=4969a482320da92e4b08f265ba9fd986ac2982a9
If the D224437 is applied as well on top of D224436, then GeckoProfiler.FeatureCombinations will fail: https://treeherder.mozilla.org/jobs?repo=try&selectedTaskRun=VQZO1QOxQsaeRK-0J0Av8Q.0&revision=6f74401fcbc9778192d65bdc2ac2fa5693521f68
Bug 1925510 seems to be dealing with a similar issue. Nazim, do you happen to know what the best approach here is? Is it ok to disable GeckoProfiler.FeatureCombinations on 32-bit Windows as Bug 1925510 did?
It looks strange. But yeah, I think your patches are unrelated to the profiler failures. The best way forward is to disable these tests on 32-bit platforms for now so it'll unblock you. I will also ask the infra folks if they changed anything related to the 32-bit machines.
The patch that disables these tests on 32-bit platforms has landed to mozilla-central.
Comment 32•1 year ago
|
||
Comment 33•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/7fcec415d328
https://hg.mozilla.org/mozilla-central/rev/bde8330f6a1c
https://hg.mozilla.org/mozilla-central/rev/0bb01cdfe814
https://hg.mozilla.org/mozilla-central/rev/7c3e23262156
https://hg.mozilla.org/mozilla-central/rev/738094007591
https://hg.mozilla.org/mozilla-central/rev/e6f664d69472
https://hg.mozilla.org/mozilla-central/rev/906fbb518c6c
https://hg.mozilla.org/mozilla-central/rev/466bf0fbcc2c
https://hg.mozilla.org/mozilla-central/rev/f07f2e98c66e
https://hg.mozilla.org/mozilla-central/rev/7efff3e68a28
Comment 34•1 year ago
|
||
(In reply to Norisz Fay [:noriszfay] from comment #33)
https://hg.mozilla.org/mozilla-central/rev/7fcec415d328
https://hg.mozilla.org/mozilla-central/rev/bde8330f6a1c
https://hg.mozilla.org/mozilla-central/rev/0bb01cdfe814
https://hg.mozilla.org/mozilla-central/rev/7c3e23262156
https://hg.mozilla.org/mozilla-central/rev/738094007591
https://hg.mozilla.org/mozilla-central/rev/e6f664d69472
https://hg.mozilla.org/mozilla-central/rev/906fbb518c6c
https://hg.mozilla.org/mozilla-central/rev/466bf0fbcc2c
https://hg.mozilla.org/mozilla-central/rev/f07f2e98c66e
https://hg.mozilla.org/mozilla-central/rev/7efff3e68a28
We're seeing improvements in mac performance here!
Thank you for all your work! :)
Perfherder has detected a mozperftest performance change from push 7efff3e68a28f3bc3685ef0b650327960bf34c5f.
Improvements:
| Ratio | Test | Platform | Options | Absolute values (old vs new) |
|---|---|---|---|---|
| 52% | test_encode_from_canvas.html realtime - frame-to-frame stddev (key) | macosx1015-64-shippable-qr | 61.82 -> 29.66 | |
| 50% | test_encode_from_canvas.html realtime - frame-to-frame mean (non key) | macosx1015-64-shippable-qr | 163.94 -> 81.64 | |
| 48% | test_encode_from_canvas.html realtime - frame-to-frame mean (non key) | macosx1015-64-shippable-qr | 175.04 -> 90.82 | |
| 46% | test_encode_from_canvas.html realtime - frame-to-frame mean (key) | macosx1015-64-shippable-qr | 157.03 -> 84.61 |
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.
If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.
You can run these tests on try with ./mach try perf --alert 42692
For more information on performance sheriffing please see our FAQ.
Description
•