Move CrossGraphReceiver usage for audio outputs from AudioStreamTrack to MediaTrackGraph
Categories
(Core :: Audio/Video: MediaStreamGraph, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox123 | --- | fixed |
People
(Reporter: karlt, Assigned: karlt)
References
Details
Attachments
(14 external files)
Outputs move from AudioStreamTrack to the MediaTracks and all outputs from the same graph to the same non-primary output device will be mixed before passing to a CrossGraphReceiver managed by the MediaTrackGraph.
This will support solutions to bug 1849108 such as choosing a non-default primary output device
and/or passing the output for a secondary output device to AudioProcessing for AEC.
PlayAudio will mix output in planar layout, suitable for CrossGraphReceiver(). Interleaving output for the AudioCallbackDriver for the primary output device will be done after, rather than before, mixing.
https://treeherder.mozilla.org/jobs?repo=try&revision=1e53183f8a7bc2a5a38f0a462052bf483d3615ee
| Assignee | ||
Comment 1•2 years ago
|
||
This will enable PlayAudio() to be used in a subsequent patch to mix audio
output for CrossGraphReceiver::EnqueueAudio().
An AudioChunk is used to clarify the planar storage and simplify use of
InterleaveAndConvertBuffer().
AudioMixer is also changed to initialize to zero only as many samples in its
buffer as will be used. Resetting to zero is no longer performed in
FinishMixing() because that is done on first call to Mix().
| Assignee | ||
Comment 2•2 years ago
|
||
AudioCallbackDriver is the only client to benefit from a callback.
StartMixing() is now required if reusing the AudioMixer because getting the
mixed data after mixing is no longer collapses the duration to zero.
Depends on D198220
| Assignee | ||
Comment 3•2 years ago
|
||
This clarifies that it is constant for all outputs mixed together and will
facilitate using PlayAudio() for secondary output devices.
Depends on D198221
| Assignee | ||
Comment 4•2 years ago
|
||
This is performed in CheckDriver() so unnecessary in RegisterAudioOutput().
Depends on D198222
| Assignee | ||
Comment 5•2 years ago
|
||
Gone since
https://hg.mozilla.org/mozilla-central/rev/95dc6464704f0fbb0c98a221cded33f9ef2eb910#l1.31
Depends on D198223
| Assignee | ||
Comment 6•2 years ago
|
||
mAudioOutputParams will also be used in a subsequent patch to support
secondary output devices in the MediaTrackGraph because a CrossGraphReceiver
will be created and destroyed on the main thread when it knows whether or not
a secondary device will be in use.
Volumes of different audio outputs (with different keys) on the same track are
coalesced on the main thread, so that the graph thread need not care about
output keys, nor mix the same stream multiple times for different keys.
Depends on D198224
| Assignee | ||
Comment 7•2 years ago
|
||
Depends on D198225
| Assignee | ||
Comment 8•2 years ago
|
||
A subsequent patch will add secondary output devices for the same graph.
The primary output device will still be the device used with an
AudioCallbackDriver.
Depends on D198226
| Assignee | ||
Comment 9•2 years ago
|
||
Cubeb does not support different input and output rates.
https://searchfox.org/mozilla-central/rev/43c40b22c776d098afb89d5237da3464a7545532/media/libcubeb/src/cubeb_wasapi.cpp#2598
Depends on D198227
| Assignee | ||
Comment 10•2 years ago
|
||
Output to secondary devices is supported through CrossGraphReceivers on other
graphs created when required.
Depends on D198228
| Assignee | ||
Comment 11•2 years ago
|
||
The MediaTrackGraphImpl is used directly rather than obtained from the
MediaTrack because, with subsequent patches, the MediaTrack may be from
another graph.
Depends on D198229
| Assignee | ||
Comment 12•2 years ago
|
||
The primary motivation for MediaStreamRenderer keeping track of and settling
incomplete promises is that, after changes in subsequent patches,
AudioStreamTrack outputs will share CrossGraphReceivers and so dedicated
CrossGraphReceivers will no longer be available to reject incomplete promises
when CrossGraphRecievers are Destroy()ed when an output is removed.
This also reliably keeps promise resolution in order wrt the synchronous
resolution from a setSinkId() call while playback is paused.
When a promise is settled because a subsequent pause or setSinkId() makes
the device change unnecessary, the promise is now resolved instead of
rejected. The new behavior is consistent with the resolution of a
promise created while playback is paused and with AudioSinkWrapper. Promise
resolution may be less likely to surprise content script than promise
rejection.
The situation with multiple tracks is somewhat arbitrary. Settling of the
promise depends on which tracks were present when setSinkId() was called.
GenericPromise::All() in MediaStreamRenderer::SetAudioOutputDevice() would
reject when the first track that existed at setSinkId() was removed or ended.
This patch switches to AllSettled() and resolves when all tracks that existed
at setSinkId() have ended. When AudioStreamTrack outputs no longer have
dedicated CrossGraphRecievers, removal of tracks will no longer cause the
promise to be settled until no tracks require the device.
Depends on D198230
| Assignee | ||
Comment 13•2 years ago
|
||
Depends on D198231
| Assignee | ||
Comment 14•2 years ago
|
||
Multiple outputs to the same device are now mixed to a single
CrossGraphReceiver and device output stream.
Depends on D198232
| Assignee | ||
Updated•2 years ago
|
Comment 15•2 years ago
|
||
Comment 16•2 years ago
|
||
Comment 17•2 years ago
|
||
| bugherder | ||
Comment 18•2 years ago
|
||
Comment 19•2 years ago
|
||
Comment 20•2 years ago
|
||
Comment 21•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/4e4d53fe90bd
https://hg.mozilla.org/mozilla-central/rev/d42cf476e404
https://hg.mozilla.org/mozilla-central/rev/1dc9f987063c
https://hg.mozilla.org/mozilla-central/rev/ae005b3084dc
https://hg.mozilla.org/mozilla-central/rev/3f91b7b85223
https://hg.mozilla.org/mozilla-central/rev/1fe2a5b597c7
https://hg.mozilla.org/mozilla-central/rev/734e2e027196
Comment 22•2 years ago
|
||
Comment 23•2 years ago
|
||
| bugherder | ||
Comment 24•2 years ago
|
||
Updated•2 years ago
|
Comment 25•2 years ago
|
||
Comment 26•2 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•2 years ago
|
Comment 27•2 years ago
|
||
Comment 28•2 years ago
|
||
Comment 29•2 years ago
|
||
| bugherder | ||
Comment 30•2 years ago
|
||
| bugherder | ||
Description
•