Bug 1546865 - Retry gUM on mic process limit collision after 200 ms. r=padenot
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 10 May 2019 16:06:09 +0000
changeset 532239 f798e09dc294fd2c86f67489ac5b1bbf5195f07d
parent 532238 ee952bc0bc518f3976227e25051eb5f1ae70a00d
child 532240 865ec5a708ba94d700672df65d5ab5ea81c01898
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1546865
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546865 - Retry gUM on mic process limit collision after 200 ms. r=padenot Differential Revision: https://phabricator.services.mozilla.com/D30290
dom/media/MediaManager.cpp
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -4102,16 +4102,20 @@ SourceListener::InitializeAsync() {
                }
 
                // SetTrack() queued the tracks. We add them synchronously here
                // to avoid races.
                stream->FinishAddTracks();
 
                if (audioDevice) {
                  nsresult rv = audioDevice->Start();
+                 if (rv == NS_ERROR_NOT_AVAILABLE) {
+                   PR_Sleep(200);
+                   rv = audioDevice->Start();
+                 }
                  if (NS_FAILED(rv)) {
                    nsString log;
                    if (rv == NS_ERROR_NOT_AVAILABLE) {
                      log.AssignLiteral("Concurrent mic process limit.");
                      aHolder.Reject(
                          MakeRefPtr<MediaMgrError>(
                              MediaMgrError::Name::NotReadableError, log),
                          __func__);
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -550,17 +550,17 @@ nsresult MediaEngineWebRTCMicrophoneSour
 
   MOZ_ASSERT(mState == kAllocated || mState == kStopped);
 
   CubebUtils::AudioDeviceID deviceID = mDeviceInfo->DeviceID();
   if (mStream->GraphImpl()->InputDeviceID() &&
       mStream->GraphImpl()->InputDeviceID() != deviceID) {
     // For now, we only allow opening a single audio input device per document,
     // because we can only have one MSG per document.
-    return NS_ERROR_FAILURE;
+    return NS_ERROR_NOT_AVAILABLE;
   }
 
   RefPtr<MediaEngineWebRTCMicrophoneSource> that = this;
   NS_DispatchToMainThread(NS_NewRunnableFunction(
       __func__, [that, deviceID, stream = mStream, track = mTrackID] {
         if (stream->IsDestroyed()) {
           return;
         }