Bug 1381638 - Prevent sharing multiple input devices in the same process. r=jesup

This commit is contained in:
Jan-Ivar Bruaroey 2017-09-15 23:00:39 -04:00
Родитель cd9cddcc94
Коммит c0da003175
2 изменённых файлов: 14 добавлений и 2 удалений

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

@ -1232,8 +1232,13 @@ public:
self->mSourceListener->GetPrincipalHandle());
if (NS_FAILED(rv)) {
nsString log;
log.AssignASCII("Starting audio failed");
error = new MediaMgrError(NS_LITERAL_STRING("InternalError"), log);
if (rv == NS_ERROR_NOT_AVAILABLE) {
log.AssignASCII("Concurrent mic process limit.");
error = new MediaMgrError(NS_LITERAL_STRING("NotReadableError"), log);
} else {
log.AssignASCII("Starting audio failed");
error = new MediaMgrError(NS_LITERAL_STRING("InternalError"), log);
}
}
}

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

@ -474,6 +474,13 @@ MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream,
return NS_ERROR_FAILURE;
}
// Until we fix bug 1400488 we need to block a second tab (OuterWindow)
// from opening an already-open device. If it's the same tab, they
// will share a Graph(), and we can allow it.
if (!mSources.IsEmpty() && aStream->Graph() != mSources[0]->Graph()) {
return NS_ERROR_NOT_AVAILABLE;
}
{
MonitorAutoLock lock(mMonitor);
mSources.AppendElement(aStream);