Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: media/video/capture/mac/video_capture_device_factory_mac.mm

Issue 362323003: Mac AVFoundation: Blackmagic camera blacklisting update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..483cf9dde2e63780cd049dc2772281da4240b9b6 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" } };
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,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 |= (strcasestr(name.id().c_str(),
tommi (sloooow) - chröme 2014/07/03 09:56:56 I don't recall seeing strcasestr being used before
tommi (sloooow) - chröme 2014/07/03 09:56:56 no need for |=. Just use = since you'll break as
mcasas 2014/07/03 12:52:56 Oops, you're right, seems to be BSD-only. I refac
mcasas 2014/07/03 12:52:56 Done.
+ kBlacklistedCameras[i].unique_id_signature) != NULL);
tommi (sloooow) - chröme 2014/07/03 09:56:56 != 0 (since the function returns int, not a pointe
mcasas 2014/07/03 12:52:56 Done.
if (is_any_device_blacklisted)
break;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698