Граф коммитов

1002 Коммитов

Автор SHA1 Сообщение Дата
Simon Giesecke 0b443059fd Bug 1693306 - Simplify some uses of LookupOrInsertWith by GetOrInsertNew. r=xpcom-reviewers,necko-reviewers,dragana,nika
Differential Revision: https://phabricator.services.mozilla.com/D105479
2021-02-26 09:22:54 +00:00
Simon Giesecke 9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Simon Giesecke 4f75368dcb Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Karl Tomlinson 43ddd69d46 Bug 1693724 Add initial memory reporting for MediaManager aggregate members r=pehrsons
Depends on D106249

Differential Revision: https://phabricator.services.mozilla.com/D106250
2021-02-24 22:38:00 +00:00
Karl Tomlinson 43c550087c Bug 1692385 move SourceListener logic needed for testing window existence into EnumerateDevicesImpl() r=pehrsons
so that EnumerateDevicesImpl() callers don't need to care about this.

This also provides a SourceListener::Stop() call to fix a leak from the logic
in GetSinkDevice().

Differential Revision: https://phabricator.services.mozilla.com/D105252
2021-02-19 05:24:24 +00:00
Karl Tomlinson 5a800090cb Bug 1692385 Remove repetition of IsWindowStillActive() test in same task r=pehrsons
The task is main-thread, so the second IsWindowStillActive() call always
returned true.

This became obsolete with
https://hg.mozilla.org/mozilla-central/rev/69b1d1c5e010097cfd7c10c9a373f72ea6873e2c#l1.587

Depends on D105250

Differential Revision: https://phabricator.services.mozilla.com/D105251
2021-02-19 04:00:45 +00:00
Karl Tomlinson 4f3448549f Bug 1692385 Add and use a helper method to create a GetUserMediaWindowListener on demand r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D105250
2021-02-19 04:00:45 +00:00
Karl Tomlinson 01891fd90a Bug 1692385 Let SourceListeners identify the GetUserMediaWindowListener from which to remove themselves r=pehrsons
This was already happening to some extent due to the recursive relationship of
SourceListener::Stop() and GetUserMediaWindowListener::Remove(), but being
direct about it saves a parameter.

Depends on D105248

Differential Revision: https://phabricator.services.mozilla.com/D105249
2021-02-19 04:00:45 +00:00
Karl Tomlinson d3248bfd2b Bug 1692385 Remove unnecessary extra active window check in EnumerateDevices() r=pehrsons
The only caller of MediaManager::EnumerateDevices() checks that the inner
window is [current] after the returned MozPromise settles and
Document::CanSavePresentation() says [no] if
MediaManager::Get()->IsWindowStillActive(win->WindowID()) so there should be
no observable difference in depending on MediaDevices::EnumerateDevices() for
the active window check.

[current]
https://searchfox.org/mozilla-central/rev/4dac9993b609fccc87e82682614faf2a44cda306/dom/media/MediaDevices.cpp#121,149
[no]
https://searchfox.org/mozilla-central/rev/d3343662ce0aced933b30e053b33c93f759292eb/dom/base/Document.cpp#10738

Depends on D105247

Differential Revision: https://phabricator.services.mozilla.com/D105248
2021-02-19 04:00:44 +00:00
Karl Tomlinson 025359ca8b Bug 1692385 remove unnecessary separate RemoveWindowID() path r=pehrsons
If GetInnerWindowWithId() returns false then RemoveWindowID() does nothing
but remove the window id from mActiveWindows if present.
https://searchfox.org/mozilla-central/rev/d3343662ce0aced933b30e053b33c93f759292eb/dom/media/MediaManager.cpp#3351,3357
GetUserMediaWindowListener::RemoveAll() is sufficient to call RemoveWindowID()
to do the same if the window id is present in mActiveWindows.
If the window id is not present, then GetWindowListener() returns false and
there is nothing to do.

The additional code path was added because IterateWindowListeners() needed a
nsPIDOMWindow,
https://hg.mozilla.org/mozilla-central/rev/786737c759d771029d393d793dff207d86f18faf#l1.60
but IterateWindowListeners() is no longer used.
https://hg.mozilla.org/mozilla-central/rev/ec16fb789a045e6d644d32bf269ff48944637c2b#l1.21

The "safe" comment is not necessary because `mActiveWindows` is clearly
documented as main-thread-only and there are plenty of main thread assertions.
https://searchfox.org/mozilla-central/rev/d3343662ce0aced933b30e053b33c93f759292eb/dom/media/MediaManager.h#332-333

Differential Revision: https://phabricator.services.mozilla.com/D105247
2021-02-19 04:00:44 +00:00
Simon Giesecke 780a1636a9 Bug 1691894 - Replace several suboptimal uses of Put after Get by GetOrInsertWith or WithEntryHandle. r=xpcom-reviewers,necko-reviewers,kmag,valentin,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D104849
2021-02-15 15:12:17 +00:00
smolnar 1afbbe67e1 Backed out 5 changesets (bug 1691894) for causing hazard failures in nsXULPrototypeCache. CLOSED TREE
Backed out changeset 22dc870ee609 (bug 1691894)
Backed out changeset 58c31e9d6ae3 (bug 1691894)
Backed out changeset 7483e84149d8 (bug 1691894)
Backed out changeset f977d6cfa973 (bug 1691894)
Backed out changeset db4503476f34 (bug 1691894)
2021-02-15 16:43:23 +02:00
Simon Giesecke 8973094ec1 Bug 1691894 - Replace several suboptimal uses of Put after Get by GetOrInsertWith or WithEntryHandle. r=xpcom-reviewers,necko-reviewers,kmag,valentin,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D104849
2021-02-15 10:04:45 +00:00
Karl Tomlinson 59f157e3ec Bug 1686406 merge GetUserMediaStreamRunnable into GetUserMediaTask r=jib
This also clarifies the safety of non-thread-safe PeerIdentity reference
counting.

There is a potential change in behavior because ~GetUserMediaStreamRunnable
rejected with AbortError, but ~GetUserMediaTask rejects with NotAllowedError.

Differential Revision: https://phabricator.services.mozilla.com/D101566
2021-02-03 08:13:24 +00:00
Karl Tomlinson 377c6ba7e2 Bug 1686406 move GetUserMediaStreamRunnable doc and Run() definition r=jib
This will make a future diff to merge GetUserMediaStreamRunnable into
GetUserMediaTask more readable.

A comment about supporting more that two tracks is removed because that is not
a likely scenario.

Differential Revision: https://phabricator.services.mozilla.com/D101565
2021-02-03 06:38:41 +00:00
Karl Tomlinson 927e525f48 Bug 1686406 update GetUserMediaStreamRunnable doc for promise API r=jib
https://hg.mozilla.org/mozilla-central/rev/46c936ce7efed56027d7770690f94ee31f415d7a#l3.166

Depends on D101563

Differential Revision: https://phabricator.services.mozilla.com/D101564
2021-02-01 17:55:24 +00:00
Karl Tomlinson afe7bc4f9b Bug 1686406 use API for nul-terminated string for call id r=jib
I expect BeginReading() happened to return the same string due to the storage
format, but using get() clarifies that this will provide what is required.

Differential Revision: https://phabricator.services.mozilla.com/D101563
2021-02-01 17:55:24 +00:00
Sylvestre Ledru b58ddc19df Bug 1519636 - Reformat recent changes to the Google coding style r=andi
Updated with Debian clang-format version 11.0.1-1

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D100934
2021-01-06 17:17:23 +00:00
Nika Layzell 6d17703514 Bug 1678463 - Part 1: Add _WITH_DELETE_ON_EVENT_TARGET macros to nsISupportsImpl, r=mccr8
This also migrates all existing users of _WITH_MAIN_THREAD_DESTRUCTION to the
new macro in nsISupportsImpl.

Differential Revision: https://phabricator.services.mozilla.com/D97825
2020-12-14 18:30:51 +00:00
Paul Adenot c416895d48 Bug 1674283 - When a mic is already off, don't attempt to turn it off. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D97333
2020-11-17 19:04:18 +00:00
Paul Adenot 14a24bbefc Bug 1674283 - Backout part of bug 1624322. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D97202
2020-11-18 15:04:13 +00:00
Sylvestre Ledru bebb9f9181 Bug 1519636 - Reformat with clang-format-11 to the Google coding style r=andi,sg,geckoview-reviewers,snorp
It is bringing some minor changes

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D90795
2020-11-18 09:05:59 +00:00
Karl Tomlinson bd1534b615 Bug 1675891 move input validation to implement already-rejected Promise return values for getUserMedia() r=jib
The navigator.mozGetUserMedia() fully active test is merged into the existing single-level
active test with a synchronous exception.  The async error dispatch for empty constraints,
which aligns with the spec, is retained.

Differential Revision: https://phabricator.services.mozilla.com/D96519
2020-11-17 04:04:25 +00:00
Karl Tomlinson dfb919d222 Bug 1213512 use UTF8 for MediaMgrError and SpeechRecognitionError message r=jib
for consistency with ErrorResult and dom::Promise, which will mean no reverse
conversion is required for rejecting Promises.

Differential Revision: https://phabricator.services.mozilla.com/D95967
2020-11-15 21:59:05 +00:00
Andreas Pehrson b9011f4a8c Bug 1651745 - Use a dedicate ProcessedMediaTrack subclass for feeding microphone capture. r=padenot
This was mainly driven by the need of querying this track for its channel count,
but it also moves us one usage away from SourceMediaTrack, which is a
longer-term goal (because of SourceMediaTrack::mMutex).

Differential Revision: https://phabricator.services.mozilla.com/D95934
2020-11-05 16:42:20 +00:00
Andreas Pehrson b8cbd64557 Bug 1651745 - Change MediaEngineSource::SetTrack to take a MediaTrack base class. r=padenot
This allows us to pass in different sub classes, which the next patch will do.

Differential Revision: https://phabricator.services.mozilla.com/D95933
2020-11-05 16:42:07 +00:00
Bryce Seager van Dyk 3b9b491f8b Bug 1669570 - Rename MediaController thread to MediaSupervisor. r=jya
This renames the thread and identifiers derived from the thread's name. This is
to avoid ambiguity over if the thread relates to the MediaController class,
which it does not.

Differential Revision: https://phabricator.services.mozilla.com/D93806
2020-10-26 15:13:37 +00:00
Andreas Pehrson c11959ec0e Bug 1597451 - Remove IterateWindowListeners altogether. r=jib,geckoview-reviewers,agi
GeckoView is seemingly the last user depending on MediaManager iterating over
a all iframes of a window when queried for its capture state.

It is fine however, since GeckoViewMedia already iterates over all windows in
MediaManagerService.activeMediaCaptureWindows, which includes all subframes that
are actively captured.

This patch removes IterateWindowListeners altogether, and the last callsite is
simplified.

Differential Revision: https://phabricator.services.mozilla.com/D93079
2020-10-19 09:56:56 +00:00
Andreas Pehrson 86ef11ab0d Bug 1597451 - Remove unnecessary IterateWindowListeners. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D93078
2020-10-19 09:52:50 +00:00
Jan-Ivar Bruaroey e3827b1882 Bug 1654430 - Fix mDeviceIDs to only track real devices and not be overwritten by other enumerateDevices requests. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D89231
2020-09-24 23:32:00 +00:00
Jan-Ivar Bruaroey 0ae206585d Bug 1654430 - Replace 200ms mainthread sleep on inserting/removing USB/bluetooth cam/mic/speaker with WaitFor() promise. r=achronop
Differential Revision: https://phabricator.services.mozilla.com/D84458
2020-09-23 16:08:58 +00:00
Simon Giesecke de7bab0f06 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82325
2020-09-23 15:17:15 +00:00
Narcis Beleuzu a2936f5009 Backed out 4 changesets (bug 1654430) for mda failure on test_ondevicechange.html . CLOSED TREE
Backed out changeset 10a70b4fad32 (bug 1654430)
Backed out changeset 495576ebc999 (bug 1654430)
Backed out changeset 0f1db7f155cb (bug 1654430)
Backed out changeset 788a6c7c52f1 (bug 1654430)
2020-09-23 16:52:16 +03:00
Jan-Ivar Bruaroey 9dcf1f976c Bug 1654430 - Fix mDeviceIDs to only track real devices and not be overwritten by other enumerateDevices requests. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D89231
2020-09-22 21:28:47 +00:00
Jan-Ivar Bruaroey 962754db51 Bug 1654430 - Replace 200ms mainthread sleep on inserting/removing USB/bluetooth cam/mic/speaker with WaitFor() promise. r=achronop
Differential Revision: https://phabricator.services.mozilla.com/D84458
2020-09-22 21:08:54 +00:00
Karl Tomlinson 9e13b21300 Bug 1646601 move fully active predicate to nsPIDOMWindowInner r=farre
Depends on D90216

Differential Revision: https://phabricator.services.mozilla.com/D90217
2020-09-15 22:13:22 +00:00
Agi Sferro d0fac0e5a3 Bug 1564451 - Add missing AddObserver calls for application-{background,foreground} r=pehrsons
This is a refuse from Bug 1658353, the AddObserver calls were removed by mistake.

Differential Revision: https://phabricator.services.mozilla.com/D89800
2020-09-11 05:41:05 +00:00
Nathan Froyd cfb8fb313f Bug 1662251 - stop assigning from NS_Convert* values, mostly; r=sg
This patch was generated by running:

```
perl -p -i \
     -e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF8toUTF16\((.*)\);/\1CopyUTF8toUTF16(\3, \2);/;' \
     -e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF16toUTF8\((.*)\);/\1CopyUTF16toUTF8(\3, \2);/;' \
     $FILE
```

against every .cpp and .h in mozilla-central, and then fixing up the
inevitable errors that happen as a result of matching C++ expressions with
regexes.  The errors fell into three categories:

1. Calling the convert functions with `std::string::c_str()`; these were
   changed to simply pass the string instead, relying on implicit conversion
   to `mozilla::Span`.
2. Calling the convert functions with raw pointers, which is not permitted
   with the copy functions; these were changed to invoke `MakeStringSpan` first.
3. Other miscellaneous errors resulting from over-eager regexes and/or the
   replacement not being type-aware.  These changes were reverted.

Differential Revision: https://phabricator.services.mozilla.com/D88903
2020-09-02 09:54:37 +00:00
Andreas Pehrson edfce94993 Bug 1658353 - Add state for microphone muting to MediaManager. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D87129
2020-08-27 15:47:00 +00:00
Mike Conley 5cc3b2e692 Bug 1658353 - Add global mute/unmute capability for microphones, with tests. r=jib
Depends on D87679

Differential Revision: https://phabricator.services.mozilla.com/D86718
2020-08-27 15:46:59 +00:00
Bogdan Tara f7dc3b755a Backed out 6 changesets (bug 1643027, bug 1658353) for browser_parsable_css.js failures CLOSED TREE
Backed out changeset e50501b54674 (bug 1643027)
Backed out changeset aa5d33b0d0b5 (bug 1643027)
Backed out changeset 51c592eb4ebd (bug 1643027)
Backed out changeset fe37ed8ba008 (bug 1658353)
Backed out changeset acb933a440c7 (bug 1658353)
Backed out changeset 7aa764991e49 (bug 1658353)
2020-08-27 18:39:49 +03:00
Andreas Pehrson f1df46bc73 Bug 1658353 - Add state for microphone muting to MediaManager. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D87129
2020-08-17 19:47:49 +00:00
Mike Conley 90e18673c3 Bug 1658353 - Add global mute/unmute capability for microphones, with tests. r=jib
Depends on D87679

Differential Revision: https://phabricator.services.mozilla.com/D86718
2020-08-26 21:35:46 +00:00
Jan-Ivar Bruaroey bd2c7c692d Bug 1652884 - Be ready to mute cameras while mobile is in the background r=agi,pehrsons
(more work needed).

Differential Revision: https://phabricator.services.mozilla.com/D87539
2020-08-20 01:55:12 +00:00
Andreas Pehrson c61e904628 Bug 1652884 - Add state for camera muting to MediaManager. r=jib
This allows newly created window listeners, in MediaManager instances where the
cameras have already been muted, to get the right state.

Differential Revision: https://phabricator.services.mozilla.com/D87127
2020-08-19 22:18:33 +00:00
Jan-Ivar Bruaroey 2c20af2dc7 Bug 1652884 - Mute new cam tracks on start when window has cameras UA muted, to avoid JS circumventing mute. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D86072
2020-08-19 22:17:58 +00:00
Jan-Ivar Bruaroey ece4d97b2f Bug 1652884 - Produce black on UA camera mute. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D86071
2020-08-19 22:18:01 +00:00
Jan-Ivar Bruaroey 27cba52636 Bug 1652884 - Add observer messages to mute/unmute all camera tracks. r=pehrsons
Add UA (user agent) muting, a spec-supported feature that somewhat mirrors
track enabling/disabling, except only the browser controls it. The effect
on track sinks is additive: must be unmuted and enabled for there to be
output.

Fire mute/unmute events on JS, and observably set track.muted independent
of track.enabled (reusing existing infrastructure already in use by
RTCPeerConnection tracks).

Low-level: add mDeviceMuted and SetMutedFor() modeled after mDeviceEnabled
and SetEnabledFor() as parallel device state for both camera and microphone for
symmetry and maintenance.

High-level: Only expose messages to mute/unmute camera at the moment, since
that is what is immediately required for Android in bug 1564451.

Differential Revision: https://phabricator.services.mozilla.com/D84222
2020-08-19 22:18:19 +00:00
Bogdan Tara 30eb420e4a Backed out 14 changesets (bug 1652884) for test_peerConnection_trackDisabling.html failures CLOSED TREE
Backed out changeset f83951453e94 (bug 1652884)
Backed out changeset fc697986d538 (bug 1652884)
Backed out changeset 20a10128b5e1 (bug 1652884)
Backed out changeset c99c32323c76 (bug 1652884)
Backed out changeset 991e8975f03d (bug 1652884)
Backed out changeset 9e9511e32cdd (bug 1652884)
Backed out changeset 605c1ac3081a (bug 1652884)
Backed out changeset dd6edf636659 (bug 1652884)
Backed out changeset 74a2f5a9eea2 (bug 1652884)
Backed out changeset b9f419aed12d (bug 1652884)
Backed out changeset 84e82e25929f (bug 1652884)
Backed out changeset 876dbad27af5 (bug 1652884)
Backed out changeset 8f60e3af2a19 (bug 1652884)
Backed out changeset de7537bda499 (bug 1652884)
2020-08-20 01:13:29 +03:00
Jan-Ivar Bruaroey b0175d3263 Bug 1652884 - Be ready to mute cameras while mobile is in the background r=agi,pehrsons
(more work needed).

Differential Revision: https://phabricator.services.mozilla.com/D87539
2020-08-19 19:30:59 +00:00