Bug 843190 - Allow cameras/mics to be shared if permissions UI is disabled. r=derf, a=bajaj
authorRandell Jesup <rjesup@jesup.org>
Wed, 20 Feb 2013 17:08:44 -0500
changeset 132241 be805356580ca0b52edb485c69b1881cbc776107
parent 132240 45da257717e0c82a62e2f56ca3f5e41d13e23dc2
child 132242 a39dd26ed4f2bc8c10b46c5ca330597ed7da4ec1
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersderf, bajaj
bugs843190
milestone21.0a2
Bug 843190 - Allow cameras/mics to be shared if permissions UI is disabled. r=derf, a=bajaj
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -608,24 +608,28 @@ public:
       count = videoSources.Length();
       if (count <= 0) {
         NS_DispatchToMainThread(new ErrorCallbackRunnable(
           mSuccess, mError, NS_LITERAL_STRING("NO_DEVICES_FOUND"), mWindowID
         ));
         return NS_ERROR_FAILURE;
       }
 
+      /**
+       * We're allowing multiple tabs to access the same camera for parity
+       * with Chrome.  See bug 811757 for some of the issues surrounding
+       * this decision.  To disallow, we'd filter by IsAvailable() as we used
+       * to.
+       */
       // Pick the first available device.
       for (uint32_t i = 0; i < count; i++) {
         nsRefPtr<MediaEngineVideoSource> vSource = videoSources[i];
-        if (vSource->IsAvailable()) {
-          found = true;
-          mVideoDevice = new MediaDevice(videoSources[i]);
-          break;
-        }
+        found = true;
+        mVideoDevice = new MediaDevice(videoSources[i]);
+        break;
       }
 
       if (!found) {
         NS_DispatchToMainThread(new ErrorCallbackRunnable(
           mSuccess, mError, NS_LITERAL_STRING("HARDWARE_UNAVAILABLE"), mWindowID
         ));
         return NS_ERROR_FAILURE;
       }
@@ -642,21 +646,19 @@ public:
         NS_DispatchToMainThread(new ErrorCallbackRunnable(
           mSuccess, mError, NS_LITERAL_STRING("NO_DEVICES_FOUND"), mWindowID
         ));
         return NS_ERROR_FAILURE;
       }
 
       for (uint32_t i = 0; i < count; i++) {
         nsRefPtr<MediaEngineAudioSource> aSource = audioSources[i];
-        if (aSource->IsAvailable()) {
-          found = true;
-          mAudioDevice = new MediaDevice(audioSources[i]);
-          break;
-        }
+        found = true;
+        mAudioDevice = new MediaDevice(audioSources[i]);
+        break;
       }
 
       if (!found) {
         NS_DispatchToMainThread(new ErrorCallbackRunnable(
           mSuccess, mError, NS_LITERAL_STRING("HARDWARE_UNAVAILABLE"), mWindowID
         ));
         return NS_ERROR_FAILURE;
       }