Bug 802326 - make getUserMedia fail if required video constraints aren't met, regardless of audio. r=jesup
authorJan-Ivar Bruaroey <jib@mozilla.com>
Thu, 05 May 2016 15:46:04 -0400
changeset 297393 e132a7cbb60bda7ec82cde7243fcfb2cad0fa362
parent 297392 2f3f8d6c0916d751337b253bc0b31f34eb8e0d8d
child 297394 1978cb1da8dc5c33b8c936ea6530b91d54d639e9
push id19218
push userkwierso@gmail.com
push dateFri, 13 May 2016 23:46:15 +0000
treeherderfx-team@93d60e9db618 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs802326
milestone49.0a1
Bug 802326 - make getUserMedia fail if required video constraints aren't met, regardless of audio. r=jesup MozReview-Commit-ID: BVT7vyNbatH
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1090,23 +1090,25 @@ MediaManager::SelectSettings(
       }
     }
     sources.Clear();
     const char* badConstraint = nullptr;
 
     if (videos.Length() && IsOn(aConstraints.mVideo)) {
       badConstraint = MediaConstraintsHelper::SelectSettings(
           GetInvariant(aConstraints.mVideo), videos);
+    }
+    if (!badConstraint && audios.Length() && IsOn(aConstraints.mAudio)) {
+      badConstraint = MediaConstraintsHelper::SelectSettings(
+          GetInvariant(aConstraints.mAudio), audios);
+    }
+    if (!badConstraint) {
       for (auto& video : videos) {
         sources.AppendElement(video);
       }
-    }
-    if (audios.Length() && IsOn(aConstraints.mAudio)) {
-      badConstraint = MediaConstraintsHelper::SelectSettings(
-          GetInvariant(aConstraints.mAudio), audios);
       for (auto& audio : audios) {
         sources.AppendElement(audio);
       }
     }
     NS_DispatchToMainThread(NewRunnableFrom([id, badConstraint]() mutable {
       RefPtr<MediaManager> mgr = MediaManager_GetInstance();
       RefPtr<PledgeChar> p = mgr->mOutstandingCharPledges.Remove(id);
       if (p) {