Bug 1307533 - support getUserMedia facingmode on Surface Book; r=jib
MozReview-Commit-ID: IOfWT2EyEPs
--- 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();
}
}