Closed Bug 1644647 Opened 4 years ago Closed 4 years ago

Linearize AudioContextOperation resolution

Categories

(Core :: Audio/Video: MediaStreamGraph, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: karlt, Assigned: karlt)

References

(Blocks 4 open bugs)

Details

Attachments

(10 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

+++ This bug was initially created as a clone of Bug #1285290 +++

We still have a fast-path when something is still using the AudioCallbackDriver, where we tell the content to resolve the promise immediately without sending it to the GraphDriver.

This causes the events to not stay in order, and blow up the state change assert back in AudioContext::OnStateChanged.

No longer depends on: 1285290

This will be helpful when delaying resumption of tracks until there is an AudioCallbackDriver.

The memory for the array is also transferred to the callee to save an allocation.

The key change here is that AudioContextOperation promises for the same
AudioContext are resolved in order as long as the graph is running.
There is one remaining case where AudioContextOperation promises can be
resolved out of order, which is when
AudioContextOperationControlMessage::RunDuringShutdown() resolves a Close
operation shortly after Run() has queued its update via mUpdateRunnables.
mUpdateRunnables are run after controlMessagesToRunDuringShutdown.
https://searchfox.org/mozilla-central/rev/ea7f70dac1c5fd18400f6d2a92679777d4b21492/dom/media/MediaTrackGraph.cpp#1793,1803

Pending resume operations are now stored on the graph instead of on
mNextDriver. This means there is no need to move operations between drivers
when switching from one mNextDriver to another, the code for which was
previously missing.

Suspend operations are performed immediately, because even a callback driver
can render nothing. Tracks are not resumed until either there is an
AudioCallbackDriver to deliver the rendered audio or the Resume operation is
canceled by a subsequent Suspend.

While the graph is running, DispatchToMainThreadStableState() is used
consistently, whereas previously this was mixed with direct Dispatch() to the
main thread, which could have the runnable Run() before main thread state had
been updated for rendering up to the time of a Suspend.

This provides that a new track does not start processing before existing
tracks in the AudioContext, which may not be resumed until an
AudioCallbackDriver is running.

Depends on D79048

and re-enable OnStateChanged() transition assertions.

Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/39f13a31bf2e
Bug 1285290 use strong pointers for tracks in ApplyAudioContextOperation() r=padenot
https://hg.mozilla.org/integration/autoland/rev/680987aac530
explicitly initialize mFallbackDriverState r=padenot
Attachment #9155535 - Attachment description: Bug 1285290 introduce PendingResumeOperation r?padenot → introduce PendingResumeOperation
Attachment #9155551 - Attachment description: Bug 1285290 remove waits for suspend and resume completion added to workaround bug 1198386 r?padenot → remove waits for suspend and resume completion added to workaround bug 1198386
Depends on: 1528874
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/71426ce4b138
use the same mechanism for the first suspended->running transition as for others r=padenot
https://hg.mozilla.org/integration/autoland/rev/fdcd2a267d75
use AudioContextOperation::Resume to start realtime AudioNodeTracks r=padenot
https://hg.mozilla.org/integration/autoland/rev/0edf554a7996
test that processing is consistent whether nodes are created before or after resume r=padenot
https://hg.mozilla.org/integration/autoland/rev/ce7f146ddc9f
introduce PendingResumeOperation r=padenot
https://hg.mozilla.org/integration/autoland/rev/6316b2fbd3b9
rewrite AudioContextOperation handling using PendingResumeOperation r=padenot
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24129 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
No longer depends on: 1528874
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/de7e71fc0ea9
remove waits for suspend and resume completion added to workaround bug 1198386 r=padenot
https://hg.mozilla.org/integration/autoland/rev/cbbe8b775137
test AudioContext state updates with suspend() shortly after construction r=padenot
https://hg.mozilla.org/integration/autoland/rev/7c5fe3b1bec5
reject promises for Close AudioContextOperations run after forced graph shutdown r=padenot
Blocks: 1638243
Upstream PR merged by jgraham
See Also: → 1489160
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: