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

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: FakeVCD and FileVCD specify AVFoundation API type. 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
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..b13496c8058bb3602e52b9fded4f9d42aa69a824 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's 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;
« no previous file with comments | « media/video/capture/mac/video_capture_device_mac.h ('k') | media/video/capture/mac/video_capture_device_qtkit_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698