Bug 1307533 - support getUserMedia facingmode on Surface Book; r=jib
authorMunro Mengjue Chiang <mchiang@mozilla.com>
Thu, 27 Oct 2016 17:55:09 +0800
changeset 320042 42550d2fd6711cc42eb955bb794f556b5a73a237
parent 320019 e5ea056e363e1de37370ab850dcd037de632b0b1
child 320043 61627f78c095d7af063ed465c545b8f5233c32e3
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1307533
milestone52.0a1
Bug 1307533 - support getUserMedia facingmode on Surface Book; r=jib MozReview-Commit-ID: IOfWT2EyEPs
dom/media/webrtc/MediaEngineCameraVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp
@@ -341,16 +341,28 @@ MediaEngineCameraVideoSource::SetName(ns
 #endif // ANDROID
 #ifdef XP_MACOSX
   // Kludge to test user-facing cameras on OSX.
   if (aName.Find(NS_LITERAL_STRING("Face")) != -1) {
     hasFacingMode = true;
     facingMode = VideoFacingModeEnum::User;
   }
 #endif
+#ifdef XP_WIN
+  // The cameras' name of Surface book are "Microsoft Camera Front" and
+  // "Microsoft Camera Rear" respectively.
+
+  if (aName.Find(NS_LITERAL_STRING("Front")) != kNotFound) {
+    hasFacingMode = true;
+    facingMode = VideoFacingModeEnum::User;
+  } else if (aName.Find(NS_LITERAL_STRING("Rear")) != kNotFound) {
+    hasFacingMode = true;
+    facingMode = VideoFacingModeEnum::Environment;
+  }
+#endif // WINDOWS
   if (hasFacingMode) {
     mFacingMode.Assign(NS_ConvertUTF8toUTF16(
         VideoFacingModeEnumValues::strings[uint32_t(facingMode)].value));
   } else {
     mFacingMode.Truncate();
   }
 }