Index: media/video/capture/mac/video_capture_device_factory_mac.mm |
diff --git a/media/video/capture/mac/video_capture_device_factory_mac.mm b/media/video/capture/mac/video_capture_device_factory_mac.mm |
index d58a25c658687e18ee8261874b4a8076b50f4c1e..7eb8fe908df50f47e742baddb961d320ec6026bb 100644 |
--- a/media/video/capture/mac/video_capture_device_factory_mac.mm |
+++ b/media/video/capture/mac/video_capture_device_factory_mac.mm |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "base/location.h" |
+#include "base/strings/string_util.h" |
#include "base/task_runner_util.h" |
#import "media/video/capture/mac/avfoundation_glue.h" |
#include "media/video/capture/mac/video_capture_device_mac.h" |
@@ -15,15 +16,12 @@ |
namespace media { |
// Some devices are not correctly supported in AVFoundation, f.i. Blackmagic, |
-// see http://crbug.com/347371. The devices are identified by USB Vendor ID and |
-// by a characteristic substring of the name, usually the vendor's name. |
+// see http://crbug.com/347371. The devices are identified by a characteristic |
+// trailing substring of uniqueId and by (part of) the vendor's name. |
const struct NameAndVid { |
- const char* vid; |
+ const char* unique_id_signature; |
const char* name; |
-} kBlacklistedCameras[] = { { "a82c", "Blackmagic" } }; |
- |
-// In device identifiers, the USB VID and PID are stored in 4 bytes each. |
-const size_t kVidPidSize = 4; |
+} kBlacklistedCameras[] = { { "-01FDA82C8A9C", "Blackmagic" } }; |
static scoped_ptr<media::VideoCaptureDevice::Names> |
EnumerateDevicesUsingQTKit() { |
@@ -102,7 +100,6 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames( |
bool is_any_device_blacklisted = false; |
DVLOG(1) << "Enumerating video capture devices using AVFoundation"; |
capture_devices = [VideoCaptureDeviceAVFoundation deviceNames]; |
- std::string device_vid; |
// Enumerate all devices found by AVFoundation, translate the info for each |
// to class Name and add it to |device_names|. |
for (NSString* key in capture_devices) { |
@@ -110,11 +107,9 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames( |
[[capture_devices valueForKey:key] UTF8String], |
[key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION); |
device_names->push_back(name); |
- // Extract the device's Vendor ID and compare to all blacklisted ones. |
- device_vid = name.GetModel().substr(0, kVidPidSize); |
for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { |
- is_any_device_blacklisted |= |
- !strcasecmp(device_vid.c_str(), kBlacklistedCameras[i].vid); |
+ is_any_device_blacklisted = EndsWith(name.id(), |
+ kBlacklistedCameras[i].unique_id_signature, false); |
if (is_any_device_blacklisted) |
break; |
} |