Bug 1582637 - Remove unnecessary MediaEngineWebRTC::mMutex. r=jib

Differential Revision: https://phabricator.services.mozilla.com/D48515

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-10-29 13:01:36 +00:00
Родитель 5e2a4e0c27
Коммит 94356644ac
2 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@ -35,10 +35,11 @@ CubebDeviceEnumerator* GetEnumerator() {
}
MediaEngineWebRTC::MediaEngineWebRTC(MediaEnginePrefs& aPrefs)
: mMutex("mozilla::MediaEngineWebRTC"),
mDelayAgnostic(aPrefs.mDelayAgnostic),
: mDelayAgnostic(aPrefs.mDelayAgnostic),
mExtendedFilter(aPrefs.mExtendedFilter),
mHasTabVideoSource(false) {
AssertIsOnOwningThread();
nsCOMPtr<nsIComponentRegistrar> compMgr;
NS_GetComponentRegistrar(getter_AddRefs(compMgr));
if (compMgr) {
@ -51,13 +52,15 @@ MediaEngineWebRTC::MediaEngineWebRTC(MediaEnginePrefs& aPrefs)
}
void MediaEngineWebRTC::SetFakeDeviceChangeEvents() {
AssertIsOnOwningThread();
GetChildAndCall(&CamerasChild::SetFakeDeviceChangeEvents);
}
void MediaEngineWebRTC::EnumerateVideoDevices(
uint64_t aWindowId, camera::CaptureEngine aCapEngine,
nsTArray<RefPtr<MediaDevice>>* aDevices) {
mMutex.AssertCurrentThreadOwns();
AssertIsOnOwningThread();
// flag sources with cross-origin exploit potential
bool scaryKind = (aCapEngine == camera::ScreenEngine ||
aCapEngine == camera::BrowserEngine);
@ -151,7 +154,7 @@ void MediaEngineWebRTC::EnumerateVideoDevices(
void MediaEngineWebRTC::EnumerateMicrophoneDevices(
uint64_t aWindowId, nsTArray<RefPtr<MediaDevice>>* aDevices) {
mMutex.AssertCurrentThreadOwns();
AssertIsOnOwningThread();
nsTArray<RefPtr<AudioDeviceInfo>> devices;
GetEnumerator()->EnumerateAudioInputDevices(devices);
@ -202,6 +205,8 @@ void MediaEngineWebRTC::EnumerateMicrophoneDevices(
void MediaEngineWebRTC::EnumerateSpeakerDevices(
uint64_t aWindowId, nsTArray<RefPtr<MediaDevice>>* aDevices) {
AssertIsOnOwningThread();
nsTArray<RefPtr<AudioDeviceInfo>> devices;
GetEnumerator()->EnumerateAudioOutputDevices(devices);
@ -235,9 +240,9 @@ void MediaEngineWebRTC::EnumerateSpeakerDevices(
void MediaEngineWebRTC::EnumerateDevices(
uint64_t aWindowId, dom::MediaSourceEnum aMediaSource,
MediaSinkEnum aMediaSink, nsTArray<RefPtr<MediaDevice>>* aDevices) {
AssertIsOnOwningThread();
MOZ_ASSERT(aMediaSource != dom::MediaSourceEnum::Other ||
aMediaSink != MediaSinkEnum::Other);
MutexAutoLock lock(mMutex);
if (MediaEngineSource::IsVideo(aMediaSource)) {
switch (aMediaSource) {
case dom::MediaSourceEnum::Window:
@ -278,9 +283,7 @@ void MediaEngineWebRTC::EnumerateDevices(
}
void MediaEngineWebRTC::Shutdown() {
// This is likely paranoia
MutexAutoLock lock(mMutex);
AssertIsOnOwningThread();
if (camera::GetCamerasChildIfExists()) {
GetChildAndCall(&CamerasChild::RemoveDeviceChangeCallback, this);
}

Просмотреть файл

@ -74,8 +74,6 @@ class MediaEngineWebRTC : public MediaEngine {
void EnumerateSpeakerDevices(uint64_t aWindowId,
nsTArray<RefPtr<MediaDevice>>*);
// gUM runnables can e.g. Enumerate from multiple threads
Mutex mMutex;
const bool mDelayAgnostic;
const bool mExtendedFilter;
// This also is set in the ctor and then never changed, but we can't make it