A fallback driver is started whenever an audio callback driver is started, to
run the graph while the audio driver starts, which can be slow.
If the audio driver has started (according to the StateCallback) but not had a
callback yet, it won't have stopped the fallback driver. The handover from the
fallback driver to the audio driver is not yet done.
We do not want to start another fallback driver in this case.
Differential Revision: https://phabricator.services.mozilla.com/D94566
Start() will assert !mStarted, but only Stop() unsets it. In case we receive an
error through the state callback and try to restart the driver we fail the above
assert. This patch unsets mStarted on error, and moves the Stop() unsetting to
the STOPPED part of the state callback, to contain all the unsetting there.
Differential Revision: https://phabricator.services.mozilla.com/D94564
A fallback driver is started whenever an audio callback driver is started, to
run the graph while the audio driver starts, which can be slow.
If the audio driver has started (according to the StateCallback) but not had a
callback yet, it won't have stopped the fallback driver. The handover from the
fallback driver to the audio driver is not yet done.
We do not want to start another fallback driver in this case.
Differential Revision: https://phabricator.services.mozilla.com/D94566
Start() will assert !mStarted, but only Stop() unsets it. In case we receive an
error through the state callback and try to restart the driver we fail the above
assert. This patch unsets mStarted on error, and moves the Stop() unsetting to
the STOPPED part of the state callback, to contain all the unsetting there.
Differential Revision: https://phabricator.services.mozilla.com/D94564
This [0] commit unties the device selection from the fact that a stream
transports voice data. Telling cubeb that the stream has voice data allows
lowering the complexity of the resampler, and lowering the impact of the
resampler on the latency.
[0]: ac3569ef18
Differential Revision: https://phabricator.services.mozilla.com/D89591
This [0] commit unties the device selection from the fact that a stream
transports voice data. Telling cubeb that the stream has voice data allows
lowering the complexity of the resampler, and lowering the impact of the
resampler on the latency.
[0]: ac3569ef18
Differential Revision: https://phabricator.services.mozilla.com/D89591
This [0] commit unties the device selection from the fact that a stream
transports voice data. Telling cubeb that the stream has voice data allows
lowering the complexity of the resampler, and lowering the impact of the
resampler on the latency.
[0]: ac3569ef18
Differential Revision: https://phabricator.services.mozilla.com/D89591
This [0] commit unties the device selection from the fact that a stream
transports voice data. Telling cubeb that the stream has voice data allows
lowering the complexity of the resampler, and lowering the impact of the
resampler on the latency.
[0]: ac3569ef18
Differential Revision: https://phabricator.services.mozilla.com/D89591
This [0] commit unties the device selection from the fact that a stream
transports voice data. Telling cubeb that the stream has voice data allows
lowering the complexity of the resampler, and lowering the impact of the
resampler on the latency.
[0]: ac3569ef18
Depends on D89590
Differential Revision: https://phabricator.services.mozilla.com/D89591
This patch changes the type of mAudioThreadId because `std:🧵:id` is
non-memovable and AudioThreadRegistry uses an nsTArray, that needs elements to
be memovable.
Differential Revision: https://phabricator.services.mozilla.com/D80466
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.
Differential Revision: https://phabricator.services.mozilla.com/D76806
Implement a ring buffer that is not thread-safe and preallocate its internal buffers. The intention is that the internal data is preallocate to any thread and then read/write operations will take place in a single thread using the memory in a ring manner.
Differential Revision: https://phabricator.services.mozilla.com/D74882
Implement a ring buffer that is not thread-safe and preallocate its internal buffers. The intention is that the internal data is preallocate to any thread and then read/write operations will take place in a single thread using the memory in a ring manner.
Differential Revision: https://phabricator.services.mozilla.com/D74882
We're doing it async, triggered during the stable state runnable, and then the
values are cached in atomic variables, so that the rendering thread can have the
info as well, for using during processing.
Differential Revision: https://phabricator.services.mozilla.com/D75331
This patch will do :
- create a sub-category `Cubeb`
- add `Cubeb` profiling labels in related codes
The advantage of doing so :
- allow us to know the percentage of time respectively we spend on cubeb and non-cubeb codes
More details :
The profiling code would include `<atomic>` which is C++ only, so I can't use the label in `cubeb.c` directly. Instead, I add labels on the `AudioStream` and `AudioCallbackDriver` where we would call cubeb related methods.
Differential Revision: https://phabricator.services.mozilla.com/D74172
Till now an AudioCallbackDriver, on error state callback, creates a FallbackDriver, which attempts to start the existing AudioCallbackDriver. If the driver has already started this creates a cr
ash because restart is not allowed.
This patch continues using the FallbackDriver, on cubeb state error but the driver has been enhanced with an error state that will not attempt to restart the driver. The fallback driver will continue advancing the graph similar to a ThreadedDriver until a driver switch takes place.
Depends on D73102
Differential Revision: https://phabricator.services.mozilla.com/D73103
The existing `MTGImpl::NotifyWhenGraphStarted()` has been enhanced to work with a MediaTrack instead of AudioNodeTrack. In addition to that, an option has been added about resolving the retuned promise in the audio thread instead of the fallback thread when the Graph has just started. Also, a unit test has been added to verify the behavior.
Differential Revision: https://phabricator.services.mozilla.com/D71339