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

Side by Side Diff: media/video/capture/mac/video_capture_device_qtkit_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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
6 6
7 #import <QTKit/QTKit.h> 7 #import <QTKit/QTKit.h>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 // Third-party drivers often throw exceptions, which are fatal in 22 // Third-party drivers often throw exceptions, which are fatal in
23 // Chromium (see comments in scoped_nsexception_enabler.h). The 23 // Chromium (see comments in scoped_nsexception_enabler.h). The
24 // following catches any exceptions and continues in an orderly 24 // following catches any exceptions and continues in an orderly
25 // fashion with no devices detected. 25 // fashion with no devices detected.
26 NSArray* captureDevices = 26 NSArray* captureDevices =
27 base::mac::RunBlockIgnoringExceptions(^{ 27 base::mac::RunBlockIgnoringExceptions(^{
28 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; 28 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo];
29 }); 29 });
30 30
31 for (QTCaptureDevice* device in captureDevices) { 31 for (QTCaptureDevice* device in captureDevices) {
32 if (![[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue]) 32 if ([[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue])
33 [deviceNames setObject:[device localizedDisplayName] 33 continue;
34 forKey:[device uniqueID]]; 34 [deviceNames setObject:[[DeviceNameAndTransportType alloc]
Robert Sesek 2014/07/01 14:16:07 Same comments as in the other file.
mcasas 2014/07/01 16:06:10 Done.
35 initWithName:[device localizedDisplayName]
36 transportType:kIOAudioDeviceTransportTypeUnknown]
37 forKey:[device uniqueID]];
35 } 38 }
36 } 39 }
37 40
38 + (NSDictionary*)deviceNames { 41 + (NSDictionary*)deviceNames {
39 NSMutableDictionary* deviceNames = 42 NSMutableDictionary* deviceNames =
40 [[[NSMutableDictionary alloc] init] autorelease]; 43 [[[NSMutableDictionary alloc] init] autorelease];
41 44
42 // TODO(shess): Post to the main thread to see if that helps 45 // TODO(shess): Post to the main thread to see if that helps
43 // http://crbug.com/139164 46 // http://crbug.com/139164
44 [self performSelectorOnMainThread:@selector(getDeviceNames:) 47 [self performSelectorOnMainThread:@selector(getDeviceNames:)
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 334
332 - (void)sendErrorString:(NSString*)error { 335 - (void)sendErrorString:(NSString*)error {
333 DLOG(ERROR) << [error UTF8String]; 336 DLOG(ERROR) << [error UTF8String];
334 [lock_ lock]; 337 [lock_ lock];
335 if (frameReceiver_) 338 if (frameReceiver_)
336 frameReceiver_->ReceiveError([error UTF8String]); 339 frameReceiver_->ReceiveError([error UTF8String]);
337 [lock_ unlock]; 340 [lock_ unlock];
338 } 341 }
339 342
340 @end 343 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698