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

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: tommi@s 2nd round of comments Created 6 years, 5 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..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;
}
« 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