Commit 264278d7 authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Block VMware Virtual Webcam from MediaFoundation. Take 2.

With MediaFoundation, VMware exposes a camera even if no physical camera
exists. The behavior of this camera is problematic and causes getUserMedia()
calls to hang.

A previous CL (crrev.com/741120) tried to block this camera, but it had
no effect because the blocking mechanism worked only on USB cameras.
This CL introduces a blocking mechanism that works on the display name for
the camera.

Local testing has shown that under DirectShow, the virtual camera is not
exposed if no physical camera exists. It works well when a physical camera
exists too.

Bug: 1044974
Change-Id: I544e33ea4a5717dd91d09784a1bc32e3e268cf0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2064996Reviewed-by: default avatarArmando Miraglia <armax@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743037}
parent e4f3abb6
......@@ -79,6 +79,7 @@ static_assert(base::size(kBlacklistedCameraNames) == BLACKLISTED_CAMERA_MAX + 1,
"kBlacklistedCameraNames should be same size as "
"BlacklistedCameraNames enum");
// Use this list only for USB webcams.
const char* const kModelIdsBlacklistedForMediaFoundation[] = {
// Devices using Empia 2860 or 2820 chips, see https://crbug.com/849636.
"eb1a:2860", "eb1a:2820", "1ce6:2820",
......@@ -100,7 +101,10 @@ const char* const kModelIdsBlacklistedForMediaFoundation[] = {
// RBG/IR camera for Windows Hello Face Auth. See https://crbug.com/984864.
"13d3:5257",
// Acer Aspire f5-573g. See https://crbug.com/1034644.
"0bda:57f2",
"0bda:57f2"};
// Use this list only for non-USB webcams.
const char* const kDisplayNamesBlacklistedForMediaFoundation[] = {
// VMware Virtual Webcams cause hangs when there is no physical Webcam.
// See https://crbug.com/1044974.
"VMware Virtual Webcam"};
......@@ -127,6 +131,12 @@ bool IsDeviceBlacklistedForMediaFoundationByModelId(
return base::Contains(kModelIdsBlacklistedForMediaFoundation, model_id);
}
bool IsDeviceBlacklistedForMediaFoundationByDisplayName(
const std::string& display_name) {
return base::Contains(kDisplayNamesBlacklistedForMediaFoundation,
display_name);
}
bool LoadMediaFoundationDlls() {
static const wchar_t* const kMfDLLs[] = {
L"%WINDIR%\\system32\\mf.dll", L"%WINDIR%\\system32\\mfplat.dll",
......@@ -650,13 +660,17 @@ void VideoCaptureDeviceFactoryWin::GetDeviceDescriptorsMediaFoundation(
const std::string device_id =
base::SysWideToUTF8(std::wstring(id, id_size));
const std::string model_id = GetDeviceModelId(device_id);
if (IsDeviceBlacklistedForMediaFoundationByModelId(model_id))
const std::string display_name =
base::SysWideToUTF8(std::wstring(name, name_size));
if (IsDeviceBlacklistedForMediaFoundationByModelId(model_id) ||
IsDeviceBlacklistedForMediaFoundationByDisplayName(
display_name)) {
continue;
}
if (list_was_empty ||
!DescriptorsContainDeviceId(*device_descriptors, device_id)) {
device_descriptors->emplace_back(
base::SysWideToUTF8(std::wstring(name, name_size)), device_id,
model_id, api_attributes.first);
device_descriptors->emplace_back(display_name, device_id, model_id,
api_attributes.first);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment