Chromium Code Reviews| 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..2b502024f0db93b42181c3c401eb6a6c7aa7e634 100644 |
| --- a/media/video/capture/mac/video_capture_device_factory_mac.mm |
| +++ b/media/video/capture/mac/video_capture_device_factory_mac.mm |
| @@ -15,15 +15,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 characteristic |
| +// substrings of the uniqueId and name, the latter usually 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" } }; |
|
tommi (sloooow) - chröme
2014/07/03 13:35:14
Should this be "-01FDA82C8A9C" to be on the safe s
mcasas
2014/07/03 13:50:26
Done.
|
| static scoped_ptr<media::VideoCaptureDevice::Names> |
| EnumerateDevicesUsingQTKit() { |
| @@ -102,7 +99,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 +106,10 @@ 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 = |
| + name.id().find(kBlacklistedCameras[i].unique_id_signature) |
|
tommi (sloooow) - chröme
2014/07/03 13:35:14
if I understand correctly, you want to make sure t
mcasas
2014/07/03 13:50:26
Nice! Done.
|
| + != std::string::npos; |
| if (is_any_device_blacklisted) |
| break; |
| } |