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

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

Issue 366593003: Mac VideoCapture: return empty GetModel() for non-USB non-built-in cameras. (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
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..6f2437db1a1bd4fc52c94381ef8d5d6a4ed2431e 100644
--- a/media/video/capture/mac/video_capture_device_factory_mac.mm
+++ b/media/video/capture/mac/video_capture_device_factory_mac.mm
@@ -4,6 +4,8 @@
#include "media/video/capture/mac/video_capture_device_factory_mac.h"
+#import <IOKit/audio/IOAudioTypes.h>
+
#include "base/bind.h"
#include "base/location.h"
#include "base/task_runner_util.h"
@@ -34,7 +36,7 @@ EnumerateDevicesUsingQTKit() {
[VideoCaptureDeviceQTKit getDeviceNames:capture_devices];
for (NSString* key in capture_devices) {
VideoCaptureDevice::Name name(
- [[capture_devices valueForKey:key] UTF8String],
+ [[[capture_devices valueForKey:key] deviceName] UTF8String],
[key UTF8String], VideoCaptureDevice::Name::QTKIT);
device_names->push_back(name);
}
@@ -106,9 +108,17 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames(
// 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) {
+ int transport_type = [[capture_devices valueForKey:key] transportType];
+ // Transport types are defined for Audio devices and reused for video.
+ VideoCaptureDevice::Name::TransportType device_transport_type =
+ (transport_type == kIOAudioDeviceTransportTypeBuiltIn ||
+ transport_type == kIOAudioDeviceTransportTypeUSB) ?
+ VideoCaptureDevice::Name::USB_OR_BUILT_IN :
+ VideoCaptureDevice::Name::OTHER_TRANSPORT;
VideoCaptureDevice::Name name(
- [[capture_devices valueForKey:key] UTF8String],
- [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION);
+ [[[capture_devices valueForKey:key] deviceName] UTF8String],
+ [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION,
+ device_transport_type);
device_names->push_back(name);
// Extract the device's Vendor ID and compare to all blacklisted ones.
device_vid = name.GetModel().substr(0, kVidPidSize);
@@ -126,7 +136,7 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames(
if (is_any_device_blacklisted) {
capture_devices = [VideoCaptureDeviceQTKit deviceNames];
for (NSString* key in capture_devices) {
- NSString* device_name = [capture_devices valueForKey:key];
+ NSString* device_name = [[capture_devices valueForKey:key] deviceName];
for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) {
if ([device_name rangeOfString:@(kBlacklistedCameras[i].name)
options:NSCaseInsensitiveSearch].length != 0) {

Powered by Google App Engine
This is Rietveld 408576698