It will now be up to the caller to determine where the decoder is going to run. This allows to simplify the audio decoders so that they can run synchronously and be wrapped in a Wasm sandbox (which doesn't support multi-threading)
The structure guarantees that all MediaDataDecoder methods are called on the same thread it's been initialised.
To achieve this, wherever a MediaDataDecoder was created, we wrap it in a MediaDataDecoderProxy that ensures that all methods are running on the given thread.
We keep the behaviour of all methods in all MediaDataDecoder to assert that they are running on the expected thread for diagnostic purposes. It could go in the future.
Video decoders that could block excessingly the thread on which they are called are made to run on their own task queue.
The Apple decoder is mostly entirely asynchronous, with the exception of the drain method which could block.
We exclude the android and omx decoders are the framework they use is 100% asynchronous and already operate on another thread.
Differential Revision: https://phabricator.services.mozilla.com/D86929
When the worklet has already received the notification to shut down, there
will be no further notfication to release another global.
Differential Revision: https://phabricator.services.mozilla.com/D85975
C++17 guarantees that "In a function-call expression, the expression that names the function is sequenced before every argument expression and every default argument."
The order of operations in the expression s now guaranteed, we can remove the comment and the workaround.
Differential Revision: https://phabricator.services.mozilla.com/D85676
We can't create a media decoder on a decoder taskqueue, as this could lead to deadlocks should a decoder attempt to dispatch a synchronous runnable.
Differential Revision: https://phabricator.services.mozilla.com/D85544
Changed error message to unlocalized in the callback and in the promise rejection in case an error occurs in audio decoding.
Also deleted localized strings and NoAudio bacause it is not used.
Differential Revision: https://phabricator.services.mozilla.com/D81337
The condition in the if is changed because the minus operation could overflow.
The declaration of sampleRate has been moved to its next use because its first value was never used.
Differential Revision: https://phabricator.services.mozilla.com/D81550
Having two classes in the inheritance chain inherit from SupportsWeakPtr
now won't compile, but you can use WeakPtr<Derived> when any base class
inherits from SupportsWeakPtr.
Differential Revision: https://phabricator.services.mozilla.com/D83674
Before P1, GetCurrentThreadSerialEventTarget would have always returned the same data as NS_GetCurrentThread, making the comment incorrect Now it will properly return the running TaskQueue if any.
This change of name more clearly exposes what they are doing, as we aren't always dealing with threads directly; but a nsISerialEventTarget
Differential Revision: https://phabricator.services.mozilla.com/D80354
and re-enable OnStateChanged() transition assertions.
Rejecting the promise avoids having AudioContextOperation promises resolve out
of order when AudioContextOperationControlMessage::RunDuringShutdown()
resolves a Close operation shortly after Run() for a previous operation has
queued its update via mUpdateRunnables. mUpdateRunnables are run after
controlMessagesToRunDuringShutdown.
https://searchfox.org/mozilla-central/rev/ea7f70dac1c5fd18400f6d2a92679777d4b21492/dom/media/MediaTrackGraph.cpp#1793,1803
AudioContext::Shutdown() takes care of rejecting JS Promises when the window
is being destroyed.
Differential Revision: https://phabricator.services.mozilla.com/D79055
The promises are rejected before shutting down threads so that they don't need
to wait for nested event loops to exit.
Differential Revision: https://phabricator.services.mozilla.com/D76807
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
Differential Revision: https://phabricator.services.mozilla.com/D79049
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.
Differential Revision: https://phabricator.services.mozilla.com/D76801
Tracks remove themselves from the graph after DestroyImpl() and so should not
be added again after this.
These methods are now invoked only on the MediaTrack removing the possibility
of calling the wrong method.
Depends on D76797
Differential Revision: https://phabricator.services.mozilla.com/D76798
DestroyMediaTrack() is called only on Unlink or destruction of the AudioDestinationNode.
If there are no references to the AudioDestinationNode, then the graph's last stream
will be destroyed and the graph will shut down itself.
Differential Revision: https://phabricator.services.mozilla.com/D74812
This patch will do :
- replace the old pref with the new pref
The advantage of doing so :
- to ensure those tests can still use the correct blocking autoplay policy
Differential Revision: https://phabricator.services.mozilla.com/D73973
This patch will do :
- replace the old pref with the new pref
The advantage of doing so :
- to ensure those tests can still use the correct blocking autoplay policy
Differential Revision: https://phabricator.services.mozilla.com/D73973
DestroyMediaTrack() is called only on Unlink or destruction of the AudioDestinationNode.
If there are no references to the AudioDestinationNode, then the graph's last stream
will be destroyed and the graph will shut down itself.
Differential Revision: https://phabricator.services.mozilla.com/D74812
CLOSED TREE
Backed out changeset f42150bdee2b (bug 1626772)
Backed out changeset ab5b637f714a (bug 1626772)
Backed out changeset fd4026a9f380 (bug 1626772)
To support checking CrossOriginIsolated in performance.now(), we need to:
- Add new types to TimerPrecisionType for nsRFPService
- System, HighResAllowed are added
- All is renamed to Normal
- Introduce a set of Reduce methods which require isSystemPrincipal and
CrossOriginIsolated to be passed and decide the TimerPrecisionType later
- Original Reduce methods should only be called when callsites know the
TimerPrecisionType. Otherwise, they should call the new methods.
- The following patches will use new methods
Differential Revision: https://phabricator.services.mozilla.com/D63293
--HG--
extra : moz-landing-system : lando
TRACE_AUDIO_CALLBACK() and TRACE_AUDIO_CALLBACK_COMMENT(aFmt, ...) log to a hardcoded thread id number. This creates confusion when more than one MTG is running because logs from different threads are depicted to the same thread line and overlapping each other. Those logging commands have been removed and the TRACE* command is used that it logs per thread-id.
Differential Revision: https://phabricator.services.mozilla.com/D69031
--HG--
extra : moz-landing-system : lando
Also adds missing includes in some files, these were previously only transivitely
included through mozilla/TypeTraits.h.
Differential Revision: https://phabricator.services.mozilla.com/D68561
--HG--
extra : moz-landing-system : lando
Moving the trace point for messages to the inner loop allow understanding what
pages are doing better (if they are creating lots of nodes or changing lots of
params, etc.). Also, it is important to be able to characterize `onmessage`
calls.
Having two tracepoints under `ProcessBlockOnPorts` allows gauging the buffer
preparation overhead. vs just the page's processing code.
Differential Revision: https://phabricator.services.mozilla.com/D67464
--HG--
extra : moz-landing-system : lando
Specifically, this renames
* nsTArray_CopyChooser to nsTArray_RelocationStrategy
* the Copy template argument of nsTArray_base to RelocationStrategy
* nsTArray_CopyWithConstructors to nsTArray_RelocateUsingMoveConstructor
* nsTArray_CopyWithMemutils to nsTArray_RelocateUsingMemutils
* DECLARE_USE_COPY_CONSTRUCTORS to MOZ_DECLARE_RELOCATE_USING_MOVE_CONSTRUCTOR
Differential Revision: https://phabricator.services.mozilla.com/D66243
--HG--
extra : moz-landing-system : lando
Those are needed, respectively to be able to ensure the stream doesn't go away
when messaging back to the control thread, and then to access the details of the
exception thrown.
Differential Revision: https://phabricator.services.mozilla.com/D64765
--HG--
extra : moz-landing-system : lando
Having nested AutoJSAPI clobbers the exception value of the innermost one on
destruction.
Differential Revision: https://phabricator.services.mozilla.com/D64763
--HG--
extra : moz-landing-system : lando
In order to be able to change the audio output device, the device id is exposed to the constructor of MediaStreamGraph. Any component that gets/creates an MTG will be able to provide the device id in order to determine the desired output device. If the provided device id is null the default device will be used.
Differential Revision: https://phabricator.services.mozilla.com/D64133
--HG--
extra : moz-landing-system : lando
This keeps the worklet/graph thread alive for control and MessagePort messages
until there are no references to main thread objects.
In test_getUserMedia_audioCapture, the track of the OscillatorNode being
recorded does not end, and, even if it did, MediaRecorder would not listen for
ended notification on the node's track but its pipe track. Recording via
DestinationNode works around this because the DestinationNode track ends and
MediaRecorder listens to this track directly because it has
EXTERNAL_OUTPUT. Previously MediaRecorder would stop when the MediaTrackGraph
was shutdown, but this is no longer happening.
Depends on D65069
Differential Revision: https://phabricator.services.mozilla.com/D65070
--HG--
extra : moz-landing-system : lando
This will allow the node to drop its self reference without
AudioContext::Shutdown().
Depends on D65068
Differential Revision: https://phabricator.services.mozilla.com/D65069
--HG--
extra : moz-landing-system : lando
This will allow the class to be used from AudioDestinationNode.
Depends on D65067
Differential Revision: https://phabricator.services.mozilla.com/D65068
--HG--
extra : moz-landing-system : lando
This covers most cycle collected objects which support weak references, but
not the ones which inherit from a cycle collected class and don't do any cycle
collection on their own.
Differential Revision: https://phabricator.services.mozilla.com/D63962
--HG--
extra : moz-landing-system : lando
This converts `nsAutoPtr` usage in dom/media to `UniquePtr`. Beyond just a
search and replace we also needed to update assignment and access of the
`UniquePtr`s. This falls into a few categories:
- Assignment from a newly constructed object switches to `MakeUnique`
- Assignment from a raw ptr switches to `UniquePtr::reset`
- Handing out a raw ptr now requires `UniquePtr::get`
- Uses `UniquePtr::release` rather than `nsAutoPtr::forget`
- A few spots are updated to return a `UniquePtr` rather than a raw ptr
Differential Revision: https://phabricator.services.mozilla.com/D60084
--HG--
extra : moz-landing-system : lando
The change to throw NotSupportedError in AudioContext::CreateBuffer is
purposeful, to align with the spec and Chrome. There's apparently no web
platform test coverage for this, but we'll work on converting our test to a WPT.
The change to AudioContext::Close is fixing what looks like an obvious bug to
me (it _resolved_ a Promise<void> with a DOMException!). No obvious test coverage; https://bugzilla.mozilla.org/show_bug.cgi?id=1614960 tracks adding some.
The change to throw RangeError in OscillatorNode::Start is purposeful, to align
wih the spec and Chrome. Again, there's apparently no test coverage.
The change to throw RangeError in OscillatorNode::Stop is purposeful, to align
wih the spec and Chrome. Again, there's apparently no test coverage.
Differential Revision: https://phabricator.services.mozilla.com/D62141
--HG--
extra : moz-landing-system : lando
This is based on looking at what the actual spec constraints around the
channelCount, channelCountMode, and channelInterpretation setters are and on
testing Chrome's behavior: the setters _can_ be called as long as you do it with
the current value. That said, the spec sure could use being clearer here; the
style it's using is pretty hard to follow, unfortunately.
Differential Revision: https://phabricator.services.mozilla.com/D62140
--HG--
extra : moz-landing-system : lando
Please review the changes to Errors.msg very carefully. I caught a number of
mistakes there in self-review (e.g. not renumbering replacement markers
correctly when I added {0} to the beginnings of strings), and my confidence
that I caught them all is only middling.
A few lines (MSG_USELESS_SETTIMEOUT, MSG_TYPEDARRAY_IS_DETACHED,
MSG_NOT_SUBMIT_BUTTON) were removed from Errors.msg either because they were
already unused or because they either were single-user constant strings or
became such in the new setup and we could just use the string version of
ThrowTypeError.
Differential Revision: https://phabricator.services.mozilla.com/D61523
--HG--
extra : moz-landing-system : lando
This adds the name of the interface and method to the beginning of the exception
string when reporting the exception from Web IDL codegen, so it's clearer what
was called.
Some existing error messages are adjusted to not duplicate the information
about which method was called.
Differential Revision: https://phabricator.services.mozilla.com/D61521
--HG--
extra : moz-landing-system : lando
Now we support [AllowShared] in WebIDL, we don't need to manually check shareness
and throw exception if API don't accept SharedArrayBuffer, the binding will handle
it.
Differential Revision: https://phabricator.services.mozilla.com/D60001
--HG--
extra : moz-landing-system : lando
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.
Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:
* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.
Differential Revision: https://phabricator.services.mozilla.com/D56440
--HG--
extra : moz-landing-system : lando
This removes a level of indirection where the graph had to call back into
AudioContext. It also removes a dependency on the graph from GraphDriver, where
it can now just resolve a MozPromiseHolder instead.
Differential Revision: https://phabricator.services.mozilla.com/D56075
--HG--
extra : moz-landing-system : lando
and don't call process() on inactive AudioWorkletProcessor when inputs are null.
AudioNodeTrack::mIsActive, which determines when ProcessBlocksOnPorts() is
called, differs slightly from "actively processing" in the spec.
"An AudioScheduledSourceNode is actively processing if and only if it is
playing for at least part of the current rendering quantum" but
AudioNodeTrack::mIsActive is set even before the source node has started
playing.
Null input blocks provide a better indication of inputs that are not actively
processing.
Differential Revision: https://phabricator.services.mozilla.com/D54663
--HG--
extra : moz-landing-system : lando
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.
find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
if [ -n "$interfaces" ]; then
if [[ "$interfaces" == *$'\n'* ]]; then
regexp="\("
for i in $interfaces; do regexp="$regexp$i\|"; done
regexp="${regexp%%\\\|}\)"
else
regexp="$interfaces"
fi
interface=$(basename "$path")
rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
if [ $hits -eq 0 ]; then
echo "Removing ${interface} from ${path2}"
grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
mv -f "$path2".tmp "$path2"
fi
done
fi
done
Differential Revision: https://phabricator.services.mozilla.com/D55442
--HG--
extra : moz-landing-system : lando
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.
find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
if [ -n "$interfaces" ]; then
if [[ "$interfaces" == *$'\n'* ]]; then
regexp="\("
for i in $interfaces; do regexp="$regexp$i\|"; done
regexp="${regexp%%\\\|}\)"
else
regexp="$interfaces"
fi
interface=$(basename "$path")
rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
if [ $hits -eq 0 ]; then
echo "Removing ${interface} from ${path2}"
grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
mv -f "$path2".tmp "$path2"
fi
done
fi
done
Differential Revision: https://phabricator.services.mozilla.com/D55442
--HG--
extra : moz-landing-system : lando
Move helper functions out from `AutoplayPolicy`, makes us clearly know which one could really be used to determine the blocking autoplay result. It also give other classes an ability to use those helper functions if they have a need.
Differential Revision: https://phabricator.services.mozilla.com/D52432
--HG--
extra : moz-landing-system : lando