Commit graph

210 commits

Author SHA1 Message Date
Karl Tomlinson
8a25ccdeef Bug 1859200 permit AppendMessage() with other ControlMessageInterface objects r=pehrsons
A similar assertion will be added to new methods for other
ControlMessageInterface objects in a subsequent patch.

MediaTrackGraphImpl::OpenAudioInput() and
AudioListener::SendListenerEngineEvent() are two of a number of cases that
construct a ControlMessage with a null track.

Differential Revision: https://phabricator.services.mozilla.com/D191061
2023-10-17 00:02:50 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Andreas Pehrson
dbf63dd2c9 Bug 1844181 - Increase drift correction's desired buffering level dynamically. r=padenot
This patch allows setting the desired buffering level on AudioDriftCorrection
dynamically. If the AudioResampler's pre-buffer has not yet been set, it will
be populated to match the new desired buffering level on the next Resample().

Differential Revision: https://phabricator.services.mozilla.com/D188188
2023-10-09 13:02:57 +00:00
Andreas Pehrson
52128827bf Bug 1851803 - Introduce SourceMediaTrack::mDirectDisabledMode. r=karlt
Similar to MediaTrack::mDisabledMode, but this is for uses on the
SourceMediaTrack producer thread. It is still signaled via a control message
from the control thread to maintain order of operations, and is protected by the
SourceMediaTrack mutex.

Differential Revision: https://phabricator.services.mozilla.com/D187554
2023-09-13 10:11:39 +00:00
Gregory Pappas
15a5560a3d Bug 1630497 - Remove dom.audioworklet.enabled and dom.worklet.enabled prefs r=padenot,webidl,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D183645
2023-07-19 12:41:18 +00:00
Cristian Tuns
b323fe0afa Backed out changeset ef60c7cdcb76 (bug 1630497) for causing multiple mochitest failures in dom/worklet/tests/* CLOSED TREE 2023-07-17 07:28:41 -04:00
Gregory Pappas
b38fbfc882 Bug 1630497 - Remove dom.audioworklet.enabled and dom.worklet.enabled prefs r=padenot,webidl,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D183645
2023-07-17 10:01:56 +00:00
Cristian Tuns
13353f56b9 Backed out changeset 16c42273dc28 (bug 1630497) for causing mochitest failures in dom/worklet/tests/* CLOSED TREE 2023-07-17 04:56:49 -04:00
Gregory Pappas
b83517c7df Bug 1630497 - Remove dom.audioworklet.enabled and dom.worklet.enabled prefs r=padenot,webidl,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D183645
2023-07-17 07:38:23 +00:00
Tom Schuster
ec4927fb6a Bug 1838415 - Introduce RFPTarget::AudioSampleRate. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D180955
2023-06-21 07:01:23 +00:00
Tom Schuster
0119f3c072 Bug 1834737 - Make RFPTarget parameter of nsIGlobalObject::ShouldResistFingerprinting non-optional. r=tjr,media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D178924
2023-05-31 09:46:53 +00:00
Emily McDonough
7e415de1e8 Bug 1829437 - Fix GCC -Wuninitialized warnings in MediaTrackGraph r=azebrowski
Differential Revision: https://phabricator.services.mozilla.com/D176196
2023-05-03 20:25:16 +00:00
Tom Schuster
16d1d2ed89 Bug 1813584 - Use fine grained RFP for CubebUtils::PreferredSampleRate. r=media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D168523
2023-02-15 10:55:31 +00:00
Karl Tomlinson
a3acab80b7 Bug 1786306 assert that an audio output to be removed is found r=padenot
AFAIK nothing depends on this, but this adds another check that the code is
behaving as expected.

Depends on D158305

Differential Revision: https://phabricator.services.mozilla.com/D158306
2022-09-30 04:13:33 +00:00
Karl Tomlinson
4268d59840 Bug 1786306 assert that there is no more than one output for each key on a track r=padenot
SetAudioOutputVolume() assumes this.

Depends on D158304

Differential Revision: https://phabricator.services.mozilla.com/D158305
2022-09-30 04:13:33 +00:00
Karl Tomlinson
382bffd9a0 Bug 1752305 AsyncShutdown() MediaTrackGrph thread r=padenot
This avoids putting a nested event loop on the stack, which may not unwind if
further threads are shutdown, leading to stack exhaustion.

GraphDriver::Shutdown() is called only after control of the graph has been
handed to the main thread so the graph is not running while this is called and
so MediaTrackGraphShutDownRunnable on the main thread should not need to wait
for thread shutdown.

Differential Revision: https://phabricator.services.mozilla.com/D151357
2022-08-17 21:33:16 +00:00
Fabrice Desré
c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel
3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Andreea Pavel
89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré
0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Paul Adenot
f40adcf8b3 Bug 1771411 - Use LifecycleStateRef() in an MTG lifecycle assertion. r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D148115
2022-06-03 10:04:35 +00:00
Chun-Min Chang
21d234b564 Bug 1764186 - Make sure MediaInputPort::Get{Source, Destination} are graph-thread only r=bwc,padenot
`MediaInputPort::Get{Source, Destination}` should be graph-thread only since the `MediaInputPort`'s `mSource` and `mDest` will be cleaned up on the graph thread [1], in case of causing some potential racing issues.

[1] https://searchfox.org/mozilla-central/rev/10edce3685369a4c73955cc8d5fcbc5a9d7598af/dom/media/MediaTrackGraph.cpp#2944-2945

Differential Revision: https://phabricator.services.mozilla.com/D143780
2022-06-01 16:52:07 +00:00
Iulian Moraru
fde9af09c2 Backed out changeset 8ff752dc79b2 (bug 1764186) for causing gtest failures on MediaTrackGraph. CLOSED TREE 2022-05-27 03:23:26 +03:00
Chun-Min Chang
73fb2e3f53 Bug 1764186 - Make sure MediaInputPort::Get{Source, Destination} are graph-thread only r=bwc,padenot
`MediaInputPort::Get{Source, Destination}` should be graph-thread only since the `MediaInputPort`'s `mSource` and `mDest` will be cleaned up on the graph thread [1], in case of causing some potential racing issues.

[1] https://searchfox.org/mozilla-central/rev/10edce3685369a4c73955cc8d5fcbc5a9d7598af/dom/media/MediaTrackGraph.cpp#2944-2945

Differential Revision: https://phabricator.services.mozilla.com/D143780
2022-05-26 23:17:49 +00:00
Paul Adenot
210c49a96c Bug 1767549 - Don't (re)start an AudioContext when still on a FallbackDriver. r=karlt
Original idea by :karlt.

Differential Revision: https://phabricator.services.mozilla.com/D147085
2022-05-24 11:41:06 +00:00
Chun-Min Chang
b9c50420dd Bug 1238038 - Remove mInputDeviceID in MediaTrackGraph r=padenot
The mInputDeviceID can be removed now since we can get the input-device
id via the DeviceInputTrackManager on the graph-thread side now.

Depends on D139444

Differential Revision: https://phabricator.services.mozilla.com/D139445
2022-04-18 18:45:37 +00:00
Chun-Min Chang
16e2771d97 Bug 1238038 - Manage MediaTrack for devices in one class r=padenot
This patch creates a class to manage all DeviceInputTracks in one place,
which simplify the code in the MediaTrackGraph.

Depends on D138726

Differential Revision: https://phabricator.services.mozilla.com/D139444
2022-04-18 18:45:36 +00:00
Chun-Min Chang
2c01e7fdbf Bug 1238038 - Allow opening multiple devices r=padenot
This patch allows website users to open multiple microphones in the same
MediaTrackGraph.

Depends on D138189

Differential Revision: https://phabricator.services.mozilla.com/D138726
2022-04-18 18:45:36 +00:00
Chun-Min Chang
086c0af18e Bug 1238038 - Add a base type of MediaTrack for different devices r=padenot
Separate common interfaces that will be used for NonNativeInputTrack
class, from NativeInputTrack, into a base class: DeviceInputTrack, where
the NonNativeInputTrack will be implemented in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D137782
2022-04-18 18:45:33 +00:00
Randell Jesup
e82e1d91cc Bug 1207753 - MediaTrackGraph* thread-safety annotations r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D130590
2022-03-28 14:26:12 +00:00
Karl Tomlinson
f611cea760 Bug 1668452 require an exact match of Window, rate, and device when selecting a MediaTrackGraph r=padenot
instead of accepting a graph with the same hash.

Differential Revision: https://phabricator.services.mozilla.com/D140622
2022-03-10 00:58:07 +00:00
Karl Tomlinson
0cee6a20a8 Bug 1668452 use Window ID instead of pointer for generating graph hash table keys r=padenot
Another Window can be allocated at the same address before its graph removes
itself from the table.

The webspeech special case with no Window no longer exists since
https://hg.mozilla.org/integration/autoland/rev/d71f9e83d6ef#l6.199

Depends on D140620

Differential Revision: https://phabricator.services.mozilla.com/D140621
2022-03-10 00:58:06 +00:00
Karl Tomlinson
26b7625842 Bug 1668452 Get graph nsISerialEventTarget from nsGlobalWindowInner::nsIEventTargetFor() instead of DispatcherTrait::AbstractMainThreadFor() r=alwu
This finishes some of the work in
https://hg.mozilla.org/mozilla-central/rev/45f6ef3e89b3#l1.146

Main thread graph tasks will now be included in about:performance duration
counters, which was not implemented for nsIGlobalObject/DispatcherTrait
https://searchfox.org/mozilla-central/rev/9ca193b4233957439583f2eadabbd3cfb4cd9fed/dom/base/DispatcherTrait.cpp#22,27
nor nsGlobalWindowInner::AbstractMainThreadFor().
https://searchfox.org/mozilla-central/rev/9ca193b4233957439583f2eadabbd3cfb4cd9fed/dom/base/DocGroup.cpp#335,345

Differential Revision: https://phabricator.services.mozilla.com/D140620
2022-03-10 00:58:06 +00:00
Mike Hommey
526e84fa47 Bug 1757122 - Replace unqualified uses of std::move. r=xpcom-reviewers,media-playback-reviewers,mccr8,bryce
Clang trunk added a warning about unqualified uses of std::move.
https://reviews.llvm.org/D119670

Differential Revision: https://phabricator.services.mozilla.com/D139681
2022-03-01 04:15:26 +00:00
Chun-Min Chang
afebeefd3e Bug 1751778 - Move declaration to if statement r=padenot
Depends on D136795

Differential Revision: https://phabricator.services.mozilla.com/D136796
2022-02-11 17:19:38 +00:00
Chun-Min Chang
fc60701613 Bug 1751778 - Allow re-evaluateing input device before starting audio r=padenot
We are going to call `AudioInputProcessing::SetRequestInputChannelCount`
in the following patch (D136922 in bug 1751963), which will call
`MediaTrackGraphImpl::ReevaluateInputDevice`, via
`MediaEngineWebRTCMicrophoneSource::ApplySettings` before starting the
`AudioInputProcessing` and creating an `AudioCallbackDriver` in
`MediaTrackGraph`. It makes sure the input-channel count meets the current
user preference before starting the audio device and the audio
processing. However, if the current `GraphDriver` is not a
`AudioCallbackDriver` when `ReevaluateInputDevice` is called, we will hit
an assertion. To allow setting the correct input-channel count before
starting the audio device, we need to replace the assertion to an if
statement.

Differential Revision: https://phabricator.services.mozilla.com/D136795
2022-02-11 17:19:37 +00:00
Sylvestre Ledru
98949ee751 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Chun-Min Chang
a8cd3b2ff0 Bug 1752449 - Hide MediaEngineWebRTCAudio include behind MOZ_WEBRTC r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D137238
2022-01-31 22:10:44 +00:00
Chun-Min Chang
397e0e1e61 Bug 1752589 - Shorten the if condition r=padenot
Depends on D137319

Differential Revision: https://phabricator.services.mozilla.com/D137320
2022-01-31 17:13:49 +00:00
Chun-Min Chang
a36c8e24ba Bug 1752589 - Rename AsAudioInputTrack() to AsAudioProcessingTrack() r=padenot
The `AudioInputTrack` is renamed to `AudioProcessingTrack` in D134629,
in Bug 1742655, so the `AsAudioInputTrack` should be renamed to
`AsAudioProcessingTrack` as well.

Differential Revision: https://phabricator.services.mozilla.com/D137319
2022-01-31 17:13:49 +00:00
Chun-Min Chang
64f63598d7 Bug 1742655 - Open/Close audio input via NativeInputTrack r=pehrsons
Move the audio-opening check logic and the creation of NativeInputTrack
in one place instead of seperating them in different functions. This
reduces the complexity of audio-opening logic in MediaTrackGraph and
make it easier to test.

Depends on D134627

Differential Revision: https://phabricator.services.mozilla.com/D134533
2022-01-27 22:29:35 +00:00
Chun-Min Chang
42a65b9589 Bug 1742655 - Remove NotifyOutputData from NativeInputTrack r=pehrsons
Depends on D134532

Differential Revision: https://phabricator.services.mozilla.com/D134627
2022-01-27 22:29:34 +00:00
Chun-Min Chang
e833dac28a Bug 1742655 - Add MaxRequestedInputChannels and HasVoiceInput r=pehrsons
Implement utility functions to query the input channel count and whether
input has voice from NativeInputTrack's users

Depends on D134527

Differential Revision: https://phabricator.services.mozilla.com/D134532
2022-01-27 22:29:34 +00:00
Chun-Min Chang
644faf33dc Bug 1742655 - Remove mDeviceTrackMap in MediaTrackGraph r=pehrsons
mDeviceTrackMap only has one element since MediaTrackGraph can have only
one input device. Besides, we can get NativeInputTrack directly from
mTracks on graph thread without accessing it from mDeviceTrackMap. The
only left reason for having mDeviceTrackMap is to check if we have any
input device on Android. On Android, the default input device id is
always nullptr, so we use a hashmap to check if MediaTrackGraph contains
any input device. However, this hashmap can be replaced by a RefPtr
storing the MediaTrack for the input device since MediaTrackGraph can
have only one input device.

Depends on D134530

Differential Revision: https://phabricator.services.mozilla.com/D134527
2022-01-27 22:29:33 +00:00
Chun-Min Chang
ba55d51d2c Bug 1742655 - Track AudioDeviceID in NativeInputTrack r=pehrsons
NativeInputTrack should have a AudioDeviceID value indicating what
device its audio source is from

Depends on D134529

Differential Revision: https://phabricator.services.mozilla.com/D134530
2022-01-27 22:29:33 +00:00
Chun-Min Chang
17f788f6ec Bug 1742655 - Move AudioInput* implementations to cpp file r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D134526
2022-01-27 22:29:31 +00:00
Chun-Min Chang
afff18dfae Bug 1751472 - Remove AudioInputSamples r=padenot
There is no need to keep AudioInputSamples after bug 1741959.

Differential Revision: https://phabricator.services.mozilla.com/D136645
2022-01-25 18:05:52 +00:00
Chun-Min Chang
4431fe27ac Bug 1746735 - Set a default PrincipalHandle to DeviceInputTrack r=pehrsons
Give a default PrincipalHandle for all the non-null audio data in
DeviceInputTrack

Differential Revision: https://phabricator.services.mozilla.com/D131871
2022-01-04 23:14:08 +00:00
Randell Jesup
92a2558069 Bug 1746917: MediaTrackGraph cleanup r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D134319
2022-01-04 13:01:14 +00:00