diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 7e3ed762360d..a06296086a28 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -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); + } } } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 3f3b6074fd4b..ff77065b09fa 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -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);