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..fb989747d29efa86d27ea2a3ba14454e132a8859 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 characteristic |
| +// substrings of the uniqueId and name, the latter usually the vendor's name. |
|
tommi (sloooow) - chröme
2014/07/03 14:06:33
nit: change 'characteristic substrings' to ... hmm
mcasas
2014/07/03 16:07:38
Done.
|
| 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,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); |
| + const bool kCaseInsensitive = false; |
|
tommi (sloooow) - chröme
2014/07/03 14:06:34
uhm... kCaseInsensitive = false, meanse case sensi
mcasas
2014/07/03 16:07:38
Yeah, the clarification didn't clarify much :) Don
|
| + is_any_device_blacklisted = EndsWith(name.id(), |
| + kBlacklistedCameras[i].unique_id_signature, kCaseInsensitive); |
| if (is_any_device_blacklisted) |
| break; |
| } |