Index: media/video/capture/mac/video_capture_device_mac.mm |
diff --git a/media/video/capture/mac/video_capture_device_mac.mm b/media/video/capture/mac/video_capture_device_mac.mm |
index 60278b761571c920e529bf4551e005a5d584794d..8b2cfe2d6934d8032332e99af58412c5d2b2fb25 100644 |
--- a/media/video/capture/mac/video_capture_device_mac.mm |
+++ b/media/video/capture/mac/video_capture_device_mac.mm |
@@ -21,6 +21,26 @@ |
#import "media/video/capture/mac/video_capture_device_avfoundation_mac.h" |
#import "media/video/capture/mac/video_capture_device_qtkit_mac.h" |
+@implementation DeviceNameAndTransportType |
+ |
+- (id)initWithName:(NSString*)deviceName transportType:(int32_t)transportType { |
+ if (self = [super init]) { |
+ deviceName_.reset([deviceName copy]); |
+ transportType_ = transportType; |
+ } |
+ return self; |
+} |
+ |
+- (NSString*)deviceName { |
+ return deviceName_; |
+} |
+ |
+- (int32_t)transportType { |
+ return transportType_; |
+} |
+ |
+@end // @implementation DeviceNameAndTransportType |
+ |
namespace media { |
const int kMinFrameRate = 1; |
@@ -307,10 +327,12 @@ static void SetAntiFlickerInUsbDevice(const int vendor_id, |
} |
const std::string VideoCaptureDevice::Name::GetModel() const { |
+ // Skip the AVFoundation not USB nor built-in devices. |
+ if (capture_api_type() == AVFOUNDATION && transport_type() != USB_OR_BUILT_IN) |
+ return ""; |
// Both PID and VID are 4 characters. |
- if (unique_id_.size() < 2 * kVidPidSize) { |
+ if (unique_id_.size() < 2 * kVidPidSize) |
return ""; |
- } |
// The last characters of device id is a concatenation of VID and then PID. |
const size_t vid_location = unique_id_.size() - 2 * kVidPidSize; |