Bug 1530488 - Disable camera for aarch64 windows builds; r=pehrsons a=lizzard
authorDan Minor <dminor@mozilla.com>
Wed, 27 Feb 2019 19:50:04 +0000
changeset 516366 38edbc4fa662
parent 516365 81574e933211
child 516367 586f46c17c45
push id1963
push userarchaeopteryx@coole-files.de
push dateWed, 13 Mar 2019 15:32:59 +0000
treeherdermozilla-release@791061efa636 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons, lizzard
bugs1530488
milestone66.0
Bug 1530488 - Disable camera for aarch64 windows builds; r=pehrsons a=lizzard This disables the camera for win64-aarch64 for Windows versions below 19H1. These versions have problems with the DirectShow implementation which prevent the camera from working properly. Differential Revision: https://phabricator.services.mozilla.com/D21272
dom/media/webrtc/MediaEngineWebRTC.cpp
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
@@ -57,16 +57,35 @@ void MediaEngineWebRTC::EnumerateVideoDe
    * We still enumerate every time, in case a new device was plugged in since
    * the last call. TODO: Verify that WebRTC actually does deal with hotplugging
    * new devices (with or without new engine creation) and accordingly adjust.
    * Enumeration is not neccessary if GIPS reports the same set of devices
    * for a given instance of the engine. Likewise, if a device was plugged out,
    * mVideoSources must be updated.
    */
   int num;
+#if defined(_ARM64_) && defined(XP_WIN)
+  // There are problems with using DirectShow on versions of Windows before
+  // 19H1 on arm64. This disables the camera on older versions of Windows.
+  if (aCapEngine == camera::CameraEngine) {
+    typedef ULONG (*RtlGetVersionFn)(LPOSVERSIONINFOEXW);
+    RtlGetVersionFn RtlGetVersion;
+    RtlGetVersion = (RtlGetVersionFn)GetProcAddress(GetModuleHandleA("ntdll"),
+                                                    "RtlGetVersion");
+    if (RtlGetVersion) {
+      OSVERSIONINFOEXW info;
+      info.dwOSVersionInfoSize = sizeof(info);
+      RtlGetVersion(&info);
+      // 19H1 is 18346
+      if (info.dwBuildNumber < 18346) {
+        return;
+      }
+    }
+  }
+#endif
   num = mozilla::camera::GetChildAndCall(
       &mozilla::camera::CamerasChild::NumberOfCaptureDevices, aCapEngine);
 
   for (int i = 0; i < num; i++) {
     char deviceName[MediaEngineSource::kMaxDeviceNameLength];
     char uniqueId[MediaEngineSource::kMaxUniqueIdLength];
     bool scarySource = false;