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

Unified Diff: media/video/capture/mac/video_capture_device_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_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;

Powered by Google App Engine
This is Rietveld 408576698